mirror of
https://github.com/fluencelabs/aqua-lib
synced 2024-12-04 07:10:24 +00:00
feat(builtin): add worker builtin definition [NET-397] (#42)
This commit is contained in:
parent
d7bc270d36
commit
f575e71e05
@ -20,7 +20,6 @@ data Service:
|
||||
blueprint_id: string
|
||||
owner_id: string
|
||||
aliases: []string
|
||||
worker_aliases: []string
|
||||
worker_id: string
|
||||
|
||||
data FunctionSignature:
|
||||
@ -349,8 +348,6 @@ data SignResult:
|
||||
-- Signature as byte array. Will be null if the call is not successful
|
||||
signature: ?[]u8
|
||||
|
||||
-- Available only on FluenceJS peers
|
||||
-- The service can also be resolved by it's host peer id
|
||||
service Sig("sig"):
|
||||
-- Signs data with the service's private key.
|
||||
-- Depending on implementation the service might check call params to restrict usage for security reasons.
|
||||
@ -358,9 +355,9 @@ service Sig("sig"):
|
||||
-- and accepts data only from the following sources:
|
||||
-- trust-graph.get_trust_bytes
|
||||
-- trust-graph.get_revocation_bytes
|
||||
-- registry.get_route_bytes
|
||||
-- registry.get_key_bytes (for FluenceJS only)
|
||||
-- registry.get_record_bytes
|
||||
-- registry.get_host_record_bytes
|
||||
-- registry.get_record_metadata_bytes
|
||||
-- Argument: data - byte array to sign
|
||||
-- Returns: signature as SignResult structure
|
||||
sign(data: []u8) -> SignResult
|
||||
@ -371,7 +368,7 @@ service Sig("sig"):
|
||||
-- Gets the peer id of the service's key pair.
|
||||
get_peer_id() -> string
|
||||
|
||||
-- Available only on rust peers
|
||||
-- Available only on rust peers
|
||||
-- Aquire service statistic
|
||||
service Stat("stat"):
|
||||
-- Detailed stats for the service and its interface functions
|
||||
|
32
workers.aqua
Normal file
32
workers.aqua
Normal file
@ -0,0 +1,32 @@
|
||||
import PeerId from "./builtin.aqua"
|
||||
|
||||
-- Available only on rust peers
|
||||
service DealWorker("worker"):
|
||||
-- Creates new worker associated with `deal_id`.
|
||||
-- Throws an error if worker exists.
|
||||
create(deal_id: ?string) -> PeerId
|
||||
|
||||
-- Returns worker peer id associated with `deal_id`.
|
||||
-- Throws an error if worker doesn't exist.
|
||||
get_peer_id(deal_id: ?string) -> PeerId
|
||||
|
||||
-- Removes worker with all deployed spells and services.
|
||||
-- Throws an error if worker doesn't exist.
|
||||
-- Worker can be removed only by worker creator or worker itself.
|
||||
remove(worker_id: PeerId)
|
||||
|
||||
-- Available only on rust peers
|
||||
-- Suitable for direct hosting
|
||||
service Worker("worker"):
|
||||
-- Creates new worker associated with `init_peer_id`.
|
||||
-- Throws an error if worker exists.
|
||||
create() -> PeerId
|
||||
|
||||
-- Returns worker peer id associated with `init_peer_id`.
|
||||
-- Throws an error if worker doesn't exist.
|
||||
get_peer_id() -> PeerId
|
||||
|
||||
-- Removes worker with all deployed spells and services.
|
||||
-- Throws an error if worker doesn't exist.
|
||||
-- Worker can be removed only by worker creator or worker itself.
|
||||
remove(worker_id: PeerId)
|
Loading…
Reference in New Issue
Block a user