diff --git a/knowledge_knowledge/node/knowledge_node_services.md b/knowledge_knowledge/node/knowledge_node_services.md index 0a6ee7a..2e36d19 100644 --- a/knowledge_knowledge/node/knowledge_node_services.md +++ b/knowledge_knowledge/node/knowledge_node_services.md @@ -26,7 +26,7 @@ Checks if there is a direct connection to the peer identified by a given PeerId Example of a service call: -```text +```clojure (call node ("peer" "is_connected") ["123D..."] ok) ``` @@ -41,7 +41,7 @@ Initiates a connection to the specified peer Example of a service call: -```text +```clojure (seq (call node ("op" "identity") ["/ip4/1.2.3.4/tcp/7777" "/ip4/1.2.3.4/tcp/9999"] addrs) (call node ("peer" "connect") ["123D..." addrs] ok) @@ -56,7 +56,7 @@ Resolves the contact of a peer via [Kademlia](https://en.wikipedia.org/wiki/Kade * _PeerId_ – id of the target peer * **Returns**: Contact - true if connection was successful -```text +```rust // get_contact return struct Contact { peer_id: PeerId, @@ -66,7 +66,7 @@ Contact { Example of a service call: -```text +```clojure (call node ("peer" "get_contact") ["123D..."] contact) ``` @@ -77,13 +77,13 @@ Get information about the peer * **Arguments**: None * **Returns:** _external address_ -```text +```json { "external_addresses": [ "/ip4/1.2.3.4/tcp/7777", "/dns4/stage.fluence.dev/tcp/19002" ] } ``` Example of service call: -```text +```clojure (call node ("peer" "identify") [] info) peer timestamp_ms ``` @@ -96,7 +96,7 @@ Get Unix timestamp in milliseconds Example of service call: -```text +```clojure (call node ("peer" "timestamp_ms") [] ts_ms) ``` @@ -109,7 +109,7 @@ Get Unix timestamp in seconds Example of service call: -```text +```clojure (call node ("peer" "timestamp_sec") [] ts_sec) ``` @@ -122,7 +122,7 @@ Instructs node to return the locally-known nodes in the Kademlia neighborhood fo Example of service call: -```text +```clojure (call node ("dht" "neighborhood") [key] peers) ``` @@ -138,7 +138,7 @@ Used to create a service on a certain node. Example of service call: -```text +```clojure (call node ("srv" "create") [blueprint_id] service_id) ``` @@ -151,7 +151,7 @@ Used to enumerate services deployed to a peer. Example of service call: -```text +```clojure (call node ("srv" "list") [] services) ``` @@ -164,7 +164,7 @@ Adds an alias on service, so service could be called not only by service\_id but Example of service call: -```text +```clojure (call node ("srv" "add_alias") [alias service_id]) ``` @@ -177,7 +177,7 @@ Retrieves the functional interface of a service running on the node specified in * Argument: service\_id – ID of the service whose interface you want to retrieve. * Returns : an interface object of the following structure: -```text +```typescript { interface: { function_signatures, record_types }, blueprint_id: "uuid-1234...", @@ -187,7 +187,7 @@ Retrieves the functional interface of a service running on the node specified in Example of service call: -```text +```clojure (call node ("srv" "get_interface") [service_id] interface) ``` @@ -200,7 +200,7 @@ Used to add modules to the node specified in the service call. * bytes – a base64 string containing the .wasm module to add. * config – an object of the following structure - ```text + ```json { "name": "my_module_name" } @@ -208,7 +208,7 @@ Used to add modules to the node specified in the service call. Example of service call: -```text +```clojure (call node ("dist" "add_module") [bytes config] hash) ``` @@ -219,7 +219,7 @@ Get a list of modules available on the node * Arguments: None * Returns: an array of objects containing module descriptions - ```text + ```json [ { "name": "moduleA", @@ -231,7 +231,7 @@ Get a list of modules available on the node Example of service call: -```text +```clojure (call node ("dist" "list_modules") [] modules) ``` @@ -242,7 +242,7 @@ Get the interface of a module * Arguments: hash of a module * Returns: an interface of the module \( see _srv get\_interface \)_ mple of service call: -```text +```clojure (call node ("dist" "get_interface") [hash] interface) ``` @@ -252,7 +252,7 @@ Used to add a blueprint to the node specified in the service call. * Arguments: blueprint – an object of the following structure - ```text + ```json { "name": "good_service", "dependencies": [ "hash:6ebff28c...", "hash:1e59875a...", "hash:d164a07..." ] @@ -265,7 +265,7 @@ Used to add a blueprint to the node specified in the service call. Example of service call: -```text +```clojure (call node ("dist" "add_blueprint") [blueprint] blueprint_id) ``` @@ -278,7 +278,7 @@ Used to get the blueprints available on the node specified in the service call. A blueprint is an object of the following structure: -```text +```json { "id": "uuid-1234-...", "name": "good_service", @@ -288,7 +288,7 @@ A blueprint is an object of the following structure: Example of service call: -```text +```clojure (call node ("dist" "list_blueprints") [] blueprints) ``` @@ -313,7 +313,7 @@ Example of service call: * With an interval parameter value _k_ passed as a string, the script executes every _k_ seconds \(21 in this case\) - ```text + ```clojure (call node ("script" "add") [script "21"] id) ``` @@ -326,7 +326,7 @@ Removes recurring script from a node. Only a creator of the script can delete it Example of service call: -```text +```clojure (call node ("script" "remove") [script_id] result) ``` @@ -335,7 +335,7 @@ Example of service call: * Arguments: None * Returns: A list of existing scripts on the node. Each object in the list is of the following structure: - ```text + ```json { "id": "uuid-1234-...", "src": "(seq (call ...", // @@ -347,7 +347,7 @@ Example of service call: Example of a service call: -```text +```clojure (call node ("script" "list") [] list) ``` @@ -357,7 +357,7 @@ Acts as an identity function. This service returns exactly what was passed to it Example of service call: -```text +```clojure (call node ("op" "identity") [args] result) ``` @@ -370,7 +370,7 @@ Used in service aliasing. ****Stores the specified service provider \(provider\) * key – a string; usually, it is a human-readable service alias. * provider – the location of the service. It is an object of the following structure: - ```text + ```json { "peer": "123D...", // PeerId of some peer in the network "service_id": "uuid-1234-..." // Optional service_id of the service running on the peer specified by peer @@ -379,7 +379,7 @@ Used in service aliasing. ****Stores the specified service provider \(provider\) Example of service call: -```text +```clojure (call node ("deprecated" "add_provider") [key provider]) ``` @@ -392,7 +392,7 @@ Used in service aliasing to retrieve providers for a given key. * Arguments: _key_ – a string; usually, it is a human-readable service alias. * Returns: an array of objects of the following structure: - ```text + ```json { "peer": "123D...", // required field "service_id": "uuid-1234-..." // optional field @@ -401,9 +401,6 @@ Used in service aliasing to retrieve providers for a given key. Example of service call: -```text +```clojure (call node ("deprecated" "get_providers") [key] providers) ``` - - -