feat(workers): deprecate API w/o deal_id; add list [NET-565] (#61)

This commit is contained in:
Aleksey Proshutinskiy 2023-11-14 13:58:37 +02:00 committed by GitHub
parent 6dff62c393
commit cce6da5f42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,41 +1,19 @@
import PeerId from "./builtin.aqua" import PeerId from "./builtin.aqua"
-- Available only on rust peers -- Available only on rust peers
service DealWorker("worker"): service Worker("worker"):
-- Creates new worker associated with `deal_id`. -- Creates new worker associated with `deal_id`.
-- Throws an error if worker exists. -- Throws an error if worker exists.
create(deal_id: ?string) -> PeerId 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
-- Returns worker peer id associated with `deal_id`. -- Returns worker peer id associated with `deal_id`.
-- Returns nil if worker doesn't exist. -- Returns nil if worker doesn't exist.
get_worker_id(deal_id: ?string) -> ?PeerId get_worker_id(deal_id: string) -> ?PeerId
-- Removes worker with all deployed spells and services. -- Removes worker with all deployed spells and services.
-- Throws an error if worker doesn't exist. -- Throws an error if worker doesn't exist.
-- Worker can be removed only by worker creator or worker itself. -- Worker can be removed only by worker creator or worker itself.
remove(worker_id: PeerId) remove(worker_id: PeerId)
-- Available only on rust peers -- Returns list of all workers.
-- Suitable for direct hosting list() -> []PeerId
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.
-- WILL BE DEPRECATED SOON, use `get_worker_id` instead.
get_peer_id() -> PeerId
-- Returns worker peer id associated with `init_peer_id`.
-- Returns nil if worker doesn't exist.
get_worker_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)