aqua-lib/workers.aqua
Nick 5414624156
feat(worker)!: add cu_ids to worker create (#82)
* feat(worker): add cu_ids to worker create

* add docs

* add docs
2024-02-19 18:35:02 +03:00

40 lines
1.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

aqua WorkersLib declares *
import PeerId from "./builtin.aqua"
-- Available only on rust peers
service Worker("worker"):
-- Creates new worker associated with `deal_id` and allows specifying custom `cu_ids`.
-- Arguments:
-- deal_id - ID of the deal
-- cu_ids an array of target compute unit IDs
-- Returns: PeerId - worker ID if creation was successful
-- Throws an error if a worker exists.
create(deal_id: string, cu_ids: []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