mirror of
https://github.com/fluencelabs/aqua-lib
synced 2024-12-04 23:30:22 +00:00
Adding argument names to builtin.aqua
For better readability
This commit is contained in:
parent
a59aef4e49
commit
f0f5b4192c
44
builtin.aqua
44
builtin.aqua
@ -1,3 +1,5 @@
|
|||||||
|
-- Default public interface of Fluence nodes
|
||||||
|
|
||||||
alias Field : []string
|
alias Field : []string
|
||||||
alias Argument : []string
|
alias Argument : []string
|
||||||
alias Bytes : []u8
|
alias Bytes : []u8
|
||||||
@ -59,65 +61,65 @@ data Contact:
|
|||||||
addresses: []string
|
addresses: []string
|
||||||
|
|
||||||
service Op("op"):
|
service Op("op"):
|
||||||
identity: -> ()
|
identity()
|
||||||
|
|
||||||
service Peer("peer"):
|
service Peer("peer"):
|
||||||
-- Checks if there is a direct connection to the peer identified by a given PeerId
|
-- 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
|
-- Argument: PeerId – id of the peer to check if there's a connection with
|
||||||
-- Returns: bool - true if connected to the peer, false otherwise
|
-- Returns: bool - true if connected to the peer, false otherwise
|
||||||
is_connected: PeerId -> bool
|
is_connected(peer: PeerId) -> bool
|
||||||
|
|
||||||
-- Initiates a connection to the specified peer
|
-- Initiates a connection to the specified peer
|
||||||
-- Arguments:
|
-- Arguments:
|
||||||
-- PeerId – id of the target peer
|
-- PeerId – id of the target peer
|
||||||
-- [Multiaddr] – an array of target peer's addresses
|
-- [Multiaddr] – an array of target peer's addresses
|
||||||
-- Returns: bool - true if connection was successful
|
-- Returns: bool - true if connection was successful
|
||||||
connect: PeerId, []string -> bool
|
connect(id: PeerId, multiaddrs: []string) -> bool
|
||||||
-- Resolves the contact of a peer via Kademlia
|
-- Resolves the contact of a peer via Kademlia
|
||||||
-- Argument: PeerId – id of the target peer
|
-- Argument: PeerId – id of the target peer
|
||||||
-- Returns: Contact - true if connection was successful
|
-- Returns: Contact - true if connection was successful
|
||||||
get_contact: PeerId -> Contact
|
get_contact(peer: PeerId) -> Contact
|
||||||
|
|
||||||
-- Get information about the peer
|
-- Get information about the peer
|
||||||
identify: -> Info
|
identify() -> Info
|
||||||
|
|
||||||
-- Get Unix timestamp in milliseconds
|
-- Get Unix timestamp in milliseconds
|
||||||
timestamp_ms: -> u64
|
timestamp_ms() -> u64
|
||||||
|
|
||||||
-- Get Unix timestamp in seconds
|
-- Get Unix timestamp in seconds
|
||||||
timestamp_sec: -> u64
|
timestamp_sec() -> u64
|
||||||
|
|
||||||
service Kademlia("kad"):
|
service Kademlia("kad"):
|
||||||
-- Instructs node to return the locally-known nodes
|
-- Instructs node to return the locally-known nodes
|
||||||
-- in the Kademlia neighborhood for a given key
|
-- in the Kademlia neighborhood for a given key
|
||||||
neighborhood: PeerId -> []PeerId
|
neighborhood(peer: PeerId) -> []PeerId
|
||||||
|
|
||||||
service Srv("srv"):
|
service Srv("srv"):
|
||||||
-- Used to create a service on a certain node
|
-- Used to create a service on a certain node
|
||||||
-- Arguments:
|
-- Arguments:
|
||||||
-- blueprint_id – ID of the blueprint that has been added to the node specified in the service call by the dist add_blueprint service.
|
-- blueprint_id – ID of the blueprint that has been added to the node specified in the service call by the dist add_blueprint service.
|
||||||
-- Returns: service_id – the service ID of the created service.
|
-- Returns: service_id – the service ID of the created service.
|
||||||
create: string -> string
|
create(blueprint_id: string) -> string
|
||||||
|
|
||||||
-- Used to remove a service from a certain node
|
-- Used to remove a service from a certain node
|
||||||
-- Arguments:
|
-- Arguments:
|
||||||
-- service_id – ID of the service to remove
|
-- service_id – ID of the service to remove
|
||||||
remove: string -> ()
|
remove(service_id: string)
|
||||||
|
|
||||||
-- Returns a list of services running on a peer
|
-- Returns a list of services running on a peer
|
||||||
list: -> []Service
|
list() -> []Service
|
||||||
|
|
||||||
-- Adds an alias on service, so, service could be called
|
-- Adds an alias on service, so, service could be called
|
||||||
-- not only by service_id but by alias as well.
|
-- not only by service_id but by alias as well.
|
||||||
-- Argument:
|
-- Argument:
|
||||||
-- alias - settable service name
|
-- alias - settable service name
|
||||||
-- service_id – ID of the service whose interface you want to name.
|
-- service_id – ID of the service whose interface you want to name.
|
||||||
add_alias: string, string -> ()
|
add_alias(alias: string, service_id: string)
|
||||||
|
|
||||||
-- Retrieves the functional interface of a service running
|
-- Retrieves the functional interface of a service running
|
||||||
-- on the node specified in the service call
|
-- on the node specified in the service call
|
||||||
-- Argument: service_id – ID of the service whose interface you want to retrieve.
|
-- Argument: service_id – ID of the service whose interface you want to retrieve.
|
||||||
get_interface: string -> ServiceInfo
|
get_interface(service_id: string) -> ServiceInfo
|
||||||
|
|
||||||
service Dist("dist"):
|
service Dist("dist"):
|
||||||
-- Used to add modules to the node specified in the service call
|
-- Used to add modules to the node specified in the service call
|
||||||
@ -125,28 +127,28 @@ service Dist("dist"):
|
|||||||
-- bytes – a base64 string containing the .wasm module to add.
|
-- bytes – a base64 string containing the .wasm module to add.
|
||||||
-- config – module info
|
-- config – module info
|
||||||
-- Returns: blake3 hash of the module
|
-- Returns: blake3 hash of the module
|
||||||
add_module: Bytes, ModuleConfig -> string
|
add_module(wasm_b56_content: Bytes, conf: ModuleConfig) -> string
|
||||||
|
|
||||||
-- Get a list of modules available on the node
|
-- Get a list of modules available on the node
|
||||||
list_modules: -> []Module
|
list_modules() -> []Module
|
||||||
|
|
||||||
-- Get the interface of a module
|
-- Get the interface of a module
|
||||||
get_interface: string -> Interface
|
get_interface(module_id: string) -> Interface
|
||||||
|
|
||||||
-- Used to add a blueprint to the node specified in the service call
|
-- Used to add a blueprint to the node specified in the service call
|
||||||
add_blueprint: AddBlueprint -> string
|
add_blueprint(blueprint: AddBlueprint) -> string
|
||||||
|
|
||||||
-- Used to get the blueprints available on the node specified in the service call.
|
-- Used to get the blueprints available on the node specified in the service call.
|
||||||
-- A blueprint is an object of the following structure
|
-- A blueprint is an object of the following structure
|
||||||
list_blueprints: -> []Blueprint
|
list_blueprints() -> []Blueprint
|
||||||
|
|
||||||
service Script("script"):
|
service Script("script"):
|
||||||
-- Adds the given script to a node
|
-- Adds the given script to a node
|
||||||
add: string, string -> string
|
add(air_content: string, run_every: string) -> string
|
||||||
|
|
||||||
-- Removes recurring script from a node. Only a creator of the script can delete it
|
-- Removes recurring script from a node. Only a creator of the script can delete it
|
||||||
remove: string -> bool
|
remove(script_id: string) -> bool
|
||||||
|
|
||||||
-- Returns a list of existing scripts on the node.
|
-- Returns a list of existing scripts on the node.
|
||||||
-- Each object in the list is of the following structure
|
-- Each object in the list is of the following structure
|
||||||
list: -> ScriptInfo
|
list() -> ScriptInfo
|
||||||
|
Loading…
Reference in New Issue
Block a user