feat: update blueprint API [NET-488] (#45)

This commit is contained in:
Aleksey Proshutisnkiy 2023-06-28 15:51:36 +03:00 committed by GitHub
parent b849728f05
commit 8db811843c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 22 deletions

View File

@ -7,13 +7,8 @@ alias PeerId : string
alias Pairs : [][]string alias Pairs : [][]string
alias Base58String : string alias Base58String : string
alias Hash : string alias Hash : string
alias IPLDBlueprint : string
-- There are two types of dependencies: named and by-hash. alias CID : string
-- name:foobar specifies dependency by module name, points to a module with import name 'foobar'
-- hash:04dc884... specifies dependency by module hash
-- By-hash dependencies are preffered since they are determenistic
-- while by-name dependency can yield different modules at different points in time
alias Dependency : string
data Service: data Service:
id: string id: string
@ -61,14 +56,10 @@ data Module:
hash: string hash: string
config: ModuleConfig config: ModuleConfig
data AddBlueprint:
name: string
dependencies: []Dependency
data Blueprint: data Blueprint:
id: string id: string
name: string name: string
dependencies: []Dependency dependencies: []CID
data ScriptInfo: data ScriptInfo:
id: string id: string
@ -304,10 +295,15 @@ service Dist("dist"):
-- Get the interface of a module -- Get the interface of a module
get_module_interface(module_hash: string) -> Interface get_module_interface(module_hash: string) -> Interface
-- Creates Blueprint structure from from blueprint name and dependencies (modules) -- Creates IPLD Blueprint structure from blueprint name and dependencies (modules)
make_blueprint(name: string, dependencies: []Dependency) -> AddBlueprint make_blueprint(name: string, dependencies: []CID) -> IPLDBlueprint
-- Add a blueprint to the node -- Add an IPLD blueprint to the node
add_blueprint(blueprint: AddBlueprint) -> string add_blueprint(blueprint: IPLDBlueprint) -> string
-- Loads blueprint by copying it from Particle Vault directory
-- Arguments:
-- blueprint_path path in Particle Vault
load_blueprint(blueprint_path: string) -> IPLDBlueprint
-- Used to get the blueprints available on the node specified in the service call. -- Used to get the blueprints available on the node specified in the service call.
-- A blueprint is an object of the following structure -- A blueprint is an object of the following structure
@ -335,7 +331,7 @@ service Script("script"):
-- (NOTE: an actual interval may vary by up to 3 seconds) -- (NOTE: an actual interval may vary by up to 3 seconds)
add_from_vault(path: string, interval: ?u64) -> string add_from_vault(path: string, interval: ?u64) -> string
-- Removes recurring script from a node. Only a creator of the script can delete it -- Removes recurring script from a node. Only the creator of the script can delete it
remove(script_id: string) -> bool remove(script_id: string) -> bool
-- Returns a list of existing scripts on the node. -- Returns a list of existing scripts on the node.
@ -382,6 +378,6 @@ service Stat("stat"):
service Debug("debug"): service Debug("debug"):
-- Convert any object into a string -- Convert any object into a string
stringify(o: ) -> string stringify(o: ) -> string
service Console("run-console"): service Console("run-console"):
print(any: ) print(any: )

View File

@ -5,11 +5,11 @@ service DealWorker("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`. -- Returns worker peer id associated with `deal_id`.
-- Throws an error if worker doesn't exist. -- Throws an error if worker doesn't exist.
get_peer_id(deal_id: ?string) -> PeerId get_peer_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.
@ -21,11 +21,11 @@ service Worker("worker"):
-- Creates new worker associated with `init_peer_id`. -- Creates new worker associated with `init_peer_id`.
-- Throws an error if worker exists. -- Throws an error if worker exists.
create() -> PeerId create() -> PeerId
-- Returns worker peer id associated with `init_peer_id`. -- Returns worker peer id associated with `init_peer_id`.
-- Throws an error if worker doesn't exist. -- Throws an error if worker doesn't exist.
get_peer_id() -> PeerId get_peer_id() -> 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.