BREAKING CHANGE: Fix get_contact, clarify connect and is_connected docs (#27)

This commit is contained in:
folex 2022-08-26 11:07:08 +04:00 committed by GitHub
parent 3298a0e23c
commit 3d5565f0e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 21 deletions

View File

@ -21,11 +21,11 @@ jobs:
key: ${{ runner.os }}-v1-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 16
- name: Install aqua compiler
run: npm install -g @fluencelabs/aqua

View File

@ -26,11 +26,11 @@ jobs:
key: ${{ runner.os }}-v1-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 16
- name: Install aqua compiler
run: npm install -g @fluencelabs/aqua
@ -41,7 +41,7 @@ jobs:
### Publish to NPM registry
- uses: actions/setup-node@v1
with:
node-version: "14"
node-version: "16"
registry-url: "https://registry.npmjs.org"
- name: Publish to NPM

View File

@ -107,22 +107,6 @@ service Op("op"):
concat_strings(a: string, b: string) -> string
service Peer("peer"):
-- Checks if there is a direct connection to the peer identified by a given PeerId
-- Argument: PeerId id of the peer to check if there's a connection with
-- Returns: bool - true if connected to the peer, false otherwise
is_connected(peer: PeerId) -> bool
-- Initiates a connection to the specified peer
-- Arguments:
-- id - id of the target peer
-- multiaddrs an array of target peer's addresses
-- Returns: bool - true if connection was successful
connect(id: PeerId, multiaddrs: ?[]string) -> bool
-- Resolves the contact of a peer via Kademlia
-- Argument: PeerId id of the target peer
-- Returns: Contact - true if connection was successful
get_contact(peer: PeerId) -> Contact
-- Get information about the peer
identify() -> Info
@ -136,6 +120,34 @@ service Peer("peer"):
-- message is returned after duration has passed
timeout(duration_ms: u64, message: string) -> string
---- Low level functions for accessing connection pool
-- Checks if there is a direct connection to the peer identified by a given PeerId
-- Argument: PeerId id of the peer to check if there's a connection with
-- Returns: bool - true if connected to the peer, false otherwise
-- NOTE:
-- This is a very low-level function, it most likely won't fit your goals.
-- It's almost always better to use race pattern to check connectivity.
-- See https://doc.fluence.dev/aqua-book/language/flow/parallel#timeout-and-race-patterns
is_connected(peer: PeerId) -> bool
-- Initiates a connection to the specified peer
-- Arguments:
-- id - id of the target peer
-- multiaddrs an array of target peer's addresses
-- Returns: bool - true if connection was successful
-- NOTE:
-- This is a low-level function, it most likely won't fit your goals.
-- Most often you just need to use `on id:` and connection will be established automatically.
connect(id: PeerId, multiaddrs: []string) -> bool
-- Returns known multiaddresses of a peer
-- Argument: PeerId id of the target peer
-- Returns:
-- Contact - if target peer is connected to current peer,
-- return data structure with multiaddresses inside, and nil otherwise.
get_contact(peer: PeerId) -> ?Contact
service Kademlia("kad"):
-- Instructs node to return the locally-known nodes
-- in the Kademlia neighborhood for a given key