mirror of
https://github.com/fluencelabs/aqua-lib
synced 2024-12-04 23:30:22 +00:00
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
aqua WorkersLib declares *
|
|
|
|
import PeerId from "./builtin.aqua"
|
|
|
|
-- Available only on rust peers
|
|
service Worker("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`.
|
|
-- Returns nil if worker doesn't exist.
|
|
get_worker_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)
|
|
|
|
-- Returns list of all workers.
|
|
list() -> []PeerId
|
|
|
|
-- 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
|