2023-03-22 17:21:44 +04:00
|
|
|
import PeerId from "./builtin.aqua"
|
|
|
|
|
|
|
|
-- Available only on rust peers
|
2023-11-14 14:06:42 +02:00
|
|
|
service Worker("worker"):
|
2023-03-22 17:21:44 +04:00
|
|
|
-- Creates new worker associated with `deal_id`.
|
|
|
|
-- Throws an error if worker exists.
|
2023-11-14 14:06:42 +02:00
|
|
|
create(deal_id: string) -> PeerId
|
2023-06-28 15:51:36 +03:00
|
|
|
|
2023-08-31 11:57:17 +03:00
|
|
|
-- Returns worker peer id associated with `deal_id`.
|
|
|
|
-- Returns nil if worker doesn't exist.
|
2023-11-14 14:06:42 +02:00
|
|
|
get_worker_id(deal_id: string) -> ?PeerId
|
2023-08-31 11:57:17 +03:00
|
|
|
|
2023-03-22 17:21:44 +04:00
|
|
|
-- 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)
|
|
|
|
|
2023-11-14 14:06:42 +02:00
|
|
|
-- Returns list of all workers.
|
|
|
|
list() -> []PeerId
|
2023-11-27 20:34:22 +02:00
|
|
|
|
|
|
|
-- Restarts worker installation spell.
|
|
|
|
-- Can be called only by system spells or peer manager,
|
|
|
|
-- Throws an error if worker doesn't exist.
|
|
|
|
activate(deal_id: string)
|
|
|
|
|
|
|
|
-- Stops all worker spells and drops all incoming particles until activation.
|
|
|
|
-- Can be called only by system spells or peer manager,
|
|
|
|
-- Throws an error if worker doesn't exist.
|
|
|
|
deactivate(deal_id: string)
|
|
|
|
|
|
|
|
-- Returns true if worker is active.
|
|
|
|
-- Throws an error if worker doesn't exist.
|
|
|
|
is_active(deal_id: string) -> bool
|