diff --git a/builtin.aqua b/builtin.aqua index 9694c89..cc78dda 100644 --- a/builtin.aqua +++ b/builtin.aqua @@ -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 diff --git a/workers.aqua b/workers.aqua new file mode 100644 index 0000000..f95cd0a --- /dev/null +++ b/workers.aqua @@ -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)