-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(builtin): add worker builtin definition [NET-397] (#42)
- Loading branch information
Showing
2 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |