mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
fix: get_and_save_workers works
This commit is contained in:
parent
e84cf4452f
commit
da9223d5c2
@ -17,4 +17,4 @@ data GetWorkersInfo:
|
||||
hosts: GetWorkersInfoHosts
|
||||
|
||||
func getWorkersInfo() -> GetWorkersInfo:
|
||||
<- GetWorkersInfo(deals=nil,hosts=GetWorkersInfoHosts(defaultWorker=GetWorkersInfoHostsDefaultWorker(definition="bafkreicggus7ukfannt5mwu6g5qgip3fjlehxumsqihby4wtynkgjvnbva",installationSpells=[GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",spellId="228360c0-0735-430a-858b-f7d761eec125",workerId="12D3KooWC5p6gScLhnit4RmDLoZAb29KHvnYpDB5J55XdukQ4ZKy")],timestamp="2023-05-08T14:35:44.538Z",relayId="12D3KooWDcpWuyrMTDinqNgmXAuRdfd2mTdY9VoXZSAet2pDzh6r")))
|
||||
<- GetWorkersInfo(deals=nil,hosts=GetWorkersInfoHosts(defaultWorker=GetWorkersInfoHostsDefaultWorker(definition="bafkreigsedbqzvof2pukkgvb3xrdb6o5lpxrlughampdbcoibjokc2evay",installationSpells=[GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR",spellId="fcad2e82-b89b-4fbe-8f07-69696ee2186b",workerId="12D3KooWGKG4icJzZSG797h9CU2JqVQN64TjFJnh53xPK4inyLbo"),GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK",spellId="53531199-1f9a-49cf-a637-a406adc24300",workerId="12D3KooWE6RuM7vkL9JdoD9yE2fgqkBWgmUH7bpyotv995LAEzzN"),GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ",spellId="e3f27d6e-bbb4-416a-852a-028aac2dcc3f",workerId="12D3KooWJ1ConV2Gc79FBvgUZJgt8gYLdMFYoGEratVSZa22jQCK")],timestamp="2023-05-02T21:24:23.361Z",relayId="12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR")))
|
||||
|
@ -239,7 +239,7 @@
|
||||
"type": "object",
|
||||
"title": "Dependencies",
|
||||
"nullable": true,
|
||||
"description": "(For advanced users) Overrides for the project dependencies",
|
||||
"description": "A map of dependency versions",
|
||||
"properties": {
|
||||
"npm": {
|
||||
"type": "object",
|
||||
@ -445,14 +445,6 @@
|
||||
]
|
||||
},
|
||||
"required": []
|
||||
},
|
||||
"aquaImports": {
|
||||
"type": "array",
|
||||
"description": "A list of path to be considered by aqua compiler to be used as imports. First dependency in the list has the highest priority. Priority of imports is considered in the following order: imports from --import flags, imports from aquaImports property in fluence.yaml, project's .fluence/aqua dir, npm dependencies from fluence.yaml, npm dependencies from user's .fluence/config.yaml, npm dependencies recommended by fluence",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
@ -1,10 +0,0 @@
|
||||
[[module]]
|
||||
name = "glaze_adapter"
|
||||
load_from = "/Users/bebo/localdev/examples/aqua-examples/ceramic-streams/target/wasm32-wasi/release/glaze_adapter.wasm"
|
||||
|
||||
[module.mounted_binaries]
|
||||
glaze = "/Users/bebo/.nvm/versions/node/v16.19.0/bin/glaze"
|
||||
|
||||
[[module]]
|
||||
name = "glaze"
|
||||
load_from = "/Users/bebo/localdev/examples/aqua-examples/ceramic-streams/target/wasm32-wasi/release/glaze.wasm"
|
@ -7,10 +7,16 @@
|
||||
version: 0
|
||||
hosts:
|
||||
defaultWorker:
|
||||
definition: bafkreicggus7ukfannt5mwu6g5qgip3fjlehxumsqihby4wtynkgjvnbva
|
||||
definition: bafkreigsedbqzvof2pukkgvb3xrdb6o5lpxrlughampdbcoibjokc2evay
|
||||
installation_spells:
|
||||
- host_id: 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE
|
||||
spell_id: 228360c0-0735-430a-858b-f7d761eec125
|
||||
worker_id: 12D3KooWC5p6gScLhnit4RmDLoZAb29KHvnYpDB5J55XdukQ4ZKy
|
||||
timestamp: 2023-05-08T14:35:44.538Z
|
||||
relayId: 12D3KooWDcpWuyrMTDinqNgmXAuRdfd2mTdY9VoXZSAet2pDzh6r
|
||||
- host_id: 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
|
||||
spell_id: fcad2e82-b89b-4fbe-8f07-69696ee2186b
|
||||
worker_id: 12D3KooWGKG4icJzZSG797h9CU2JqVQN64TjFJnh53xPK4inyLbo
|
||||
- host_id: 12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
|
||||
spell_id: 53531199-1f9a-49cf-a637-a406adc24300
|
||||
worker_id: 12D3KooWE6RuM7vkL9JdoD9yE2fgqkBWgmUH7bpyotv995LAEzzN
|
||||
- host_id: 12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
|
||||
spell_id: e3f27d6e-bbb4-416a-852a-028aac2dcc3f
|
||||
worker_id: 12D3KooWJ1ConV2Gc79FBvgUZJgt8gYLdMFYoGEratVSZa22jQCK
|
||||
timestamp: 2023-05-02T21:24:23.361Z
|
||||
relayId: 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
|
||||
|
@ -16,13 +16,15 @@ deals:
|
||||
hosts:
|
||||
defaultWorker:
|
||||
peerIds:
|
||||
- 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE #stage
|
||||
# - 12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt # kras
|
||||
# - 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR # local
|
||||
relays: stage # kras
|
||||
- 12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e
|
||||
relays:
|
||||
kras
|
||||
# - /ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
|
||||
# - /ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
|
||||
# - /ip4/127.0.0.1/tcp/9993/ws/p2p/12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
|
||||
services:
|
||||
glaze:
|
||||
get: service
|
||||
dependencies:
|
||||
npm:
|
||||
"@fluencelabs/aqua-ipfs": 0.5.11
|
||||
|
@ -8,5 +8,4 @@ version: 0
|
||||
type: rust
|
||||
name: glaze_adapter
|
||||
mountedBinaries:
|
||||
# glaze: /Users/bebo/.nvm/versions/node/v16.19.0/bin/glaze
|
||||
glaze: /usr/bin/glaze
|
||||
|
@ -1,5 +1,8 @@
|
||||
aqua Main
|
||||
|
||||
import Ipfs, IpfsGetResult from "/Users/folex/Library/pnpm/global/5/node_modules/@fluencelabs/aqua-ipfs/ipfs.aqua"
|
||||
import "/Users/folex/Library/pnpm/global/5/node_modules/@fluencelabs/installation-spell/src/aqua/json.aqua"
|
||||
|
||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
import "@fluencelabs/registry/subnetwork.aqua"
|
||||
import Registry, Record from "@fluencelabs/registry/registry-service.aqua"
|
||||
@ -8,32 +11,91 @@ import "@fluencelabs/spell/spell_service.aqua"
|
||||
import "workers.aqua"
|
||||
import "services.aqua"
|
||||
|
||||
export did_create, did_create_w
|
||||
|
||||
export did_create, did_create_w, try_ipfs, check_def, set_ipfs_timeout
|
||||
|
||||
|
||||
service Console("run-console"):
|
||||
print(any: ⊤)
|
||||
-- print(any: ?[]string)
|
||||
|
||||
func getWorkers() -> []Record, []Error:
|
||||
service J("json"):
|
||||
parse(s: string) -> ⊤
|
||||
|
||||
func getWorkers() -> []GetWorkersInfoHostsDefaultWorkerInstallationSpells:
|
||||
workersInfo <- getWorkersInfo()
|
||||
dealId = workersInfo.deals.defaultWorker.dealId
|
||||
workersOp, err <- resolveSubnetwork(dealId)
|
||||
if err.length > 0:
|
||||
Console.print(["err not empty: ", workersOp!.length, err])
|
||||
<- workersOp!, err
|
||||
|
||||
spells = workersInfo.hosts.defaultWorker.installationSpells
|
||||
<- spells
|
||||
|
||||
|
||||
func did_create() -> string:
|
||||
workers, err <- getWorkers()
|
||||
-- if err.length > 0:
|
||||
-- do something
|
||||
workers <- getWorkers()
|
||||
w = workers[0]
|
||||
on w.metadata.peer_id via w.metadata.relay_id:
|
||||
on w.workerId via w.hostId:
|
||||
res = Glaze.did_create()
|
||||
<- res.stdout
|
||||
|
||||
func check_def(ipfs: string, worker_def_cid: string) -> string:
|
||||
print = (m: ⊤):
|
||||
Console.print(m)
|
||||
|
||||
workers <- getWorkers()
|
||||
w = workers[0]
|
||||
on w.workerId via w.hostId:
|
||||
try:
|
||||
-- download App Config from IPFS
|
||||
json <- Ipfs.cat_from(worker_def_cid, ipfs)
|
||||
print(json)
|
||||
if json.success:
|
||||
worker_definition <- WDJson.parse(json.contents)
|
||||
|
||||
for s <- worker_definition.services:
|
||||
try:
|
||||
hashes: *Hash
|
||||
for m <- s.modules:
|
||||
get_wasm <- Ipfs.get_from(m.wasm, ipfs)
|
||||
json_cfg <- Ipfs.cat_from(m.config, ipfs)
|
||||
cfg <- ModuleConfigJson.parse(json_cfg.contents)
|
||||
hash <- Dist.add_module_from_vault(get_wasm.path, cfg)
|
||||
hashes <- Op.concat_strings("hash:", hash)
|
||||
|
||||
blueprint <- Dist.make_blueprint(s.name, hashes)
|
||||
blueprint_id <- Dist.add_blueprint(blueprint)
|
||||
|
||||
print(blueprint)
|
||||
|
||||
-- co print([s.name, "deployed", is_deployed(s.name, blueprint_id)])
|
||||
catch e:
|
||||
print(e)
|
||||
|
||||
<- "OK"
|
||||
|
||||
func try_ipfs(ipfs: string) -> string:
|
||||
print = (w: ⊤):
|
||||
Console.print(w)
|
||||
workers <- getWorkers()
|
||||
for w <- workers:
|
||||
on w.workerId via w.hostId:
|
||||
-- Ipfs.set_timeout(10)
|
||||
-- get_wasm <- Ipfs.get_from("bafkreibzipsyogrdxm4gw6yalusuq3ybrszbxldti7g4ixbvcrqiummrqe", ipfs)
|
||||
cat1 <- Ipfs.cat_from("bafkreifdumx7wmxpma6ajigqliv2p65myf2caxrthbqh2zzp6smh57d6eq", ipfs)
|
||||
cat2 <- Ipfs.cat_from("bafkreig6zfn7ajb66x3lymq3732brlddqakrwde2rwkc6j6jz4dha5oze4", ipfs)
|
||||
-- print(get_wasm)
|
||||
-- print(cat1)
|
||||
-- print(cat2)
|
||||
p1 <- J.parse(cat1.contents)
|
||||
p2 <- J.parse(cat2.contents)
|
||||
print(p1)
|
||||
print(p2)
|
||||
<- "OK"
|
||||
|
||||
func set_ipfs_timeout(ipfs: string) -> string:
|
||||
workers <- getWorkers()
|
||||
for w <- workers:
|
||||
on w.workerId via w.hostId:
|
||||
Ipfs.set_timeout(10)
|
||||
-- get_wasm <- Ipfs.get_from("bafkreibzipsyogrdxm4gw6yalusuq3ybrszbxldti7g4ixbvcrqiummrqe", ipfs)
|
||||
<- "OK"
|
||||
|
||||
func did_create_w() -> string:
|
||||
info <- getWorkersInfo()
|
||||
spell = info.hosts.defaultWorker.installationSpells[0]
|
||||
|
@ -1,14 +1,3 @@
|
||||
data GetWorkersInfoDealsDefaultWorker:
|
||||
definition: string
|
||||
timestamp: string
|
||||
dealIdOriginal: string
|
||||
dealId: string
|
||||
chainNetwork: string
|
||||
chainNetworkId: u64
|
||||
|
||||
data GetWorkersInfoDeals:
|
||||
defaultWorker: GetWorkersInfoDealsDefaultWorker
|
||||
|
||||
data GetWorkersInfoHostsDefaultWorkerInstallationSpells:
|
||||
hostId: string
|
||||
spellId: string
|
||||
@ -24,8 +13,8 @@ data GetWorkersInfoHosts:
|
||||
defaultWorker: GetWorkersInfoHostsDefaultWorker
|
||||
|
||||
data GetWorkersInfo:
|
||||
deals: GetWorkersInfoDeals
|
||||
deals: ?u8
|
||||
hosts: GetWorkersInfoHosts
|
||||
|
||||
func getWorkersInfo() -> GetWorkersInfo:
|
||||
<- GetWorkersInfo(deals=GetWorkersInfoDeals(defaultWorker=GetWorkersInfoDealsDefaultWorker(definition="bafkreicdordcic2qmd2pnacl5adffsuhwg4eleu4prcgaldjvzr6ds2f2m",timestamp="2023-04-23T07:01:18.682Z",dealIdOriginal="0x9d7503E13Bc2d3430536e3d5D635D8172141d884",dealId="9d7503e13bc2d3430536e3d5d635d8172141d884",chainNetwork="testnet",chainNetworkId=1313161555)),hosts=GetWorkersInfoHosts(defaultWorker=GetWorkersInfoHostsDefaultWorker(definition="bafkreicdordcic2qmd2pnacl5adffsuhwg4eleu4prcgaldjvzr6ds2f2m",installationSpells=[GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",spellId="039f4e06-923e-4a21-8814-8164fa9b137c",workerId="12D3KooWKsxVXgnpL4wrTts9d49jiNSEN1auaxotdMYa4HpFS66g")],timestamp="2023-04-23T07:00:05.549Z",relayId="12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA")))
|
||||
<- GetWorkersInfo(deals=nil,hosts=GetWorkersInfoHosts(defaultWorker=GetWorkersInfoHostsDefaultWorker(definition="bafkreiexli7oujwfx7tbcpdqg2t5d7h5vwlmbksvx5dnkw6mktldiwxgam",installationSpells=[GetWorkersInfoHostsDefaultWorkerInstallationSpells(hostId="12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e",spellId="53a712a3-90a9-4f64-b7fe-01ed275bc30d",workerId="12D3KooWPHwmfqHY7wbxZZSbXyc8iM8UNnFXZMiwvEJ6aURih2ir")],timestamp="2023-05-26T17:09:39.149Z",relayId="12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn")))
|
||||
|
@ -1,29 +0,0 @@
|
||||
{
|
||||
"type": "object",
|
||||
"$id": "https://fluence.dev/schemas/fluence-lock.yaml",
|
||||
"title": "fluence-lock.yaml",
|
||||
"description": "Defines a lock file for Fluence Project dependencies. When dependencies are installed - their exact versions are saved here.",
|
||||
"properties": {
|
||||
"npm": {
|
||||
"type": "object",
|
||||
"title": "npm dependencies",
|
||||
"description": "A map of the exact npm dependency versions. CLI ensures dependencies are installed each time you run aqua",
|
||||
"required": [],
|
||||
"nullable": true
|
||||
},
|
||||
"cargo": {
|
||||
"type": "object",
|
||||
"title": "Cargo dependencies",
|
||||
"description": "A map of the exact cargo dependency versions. CLI ensures dependencies are installed each time you run commands that depend on Marine or Marine REPL",
|
||||
"required": [],
|
||||
"nullable": true
|
||||
},
|
||||
"version": {
|
||||
"type": "number",
|
||||
"const": 0
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"version"
|
||||
]
|
||||
}
|
@ -453,6 +453,11 @@
|
||||
"type": "string"
|
||||
},
|
||||
"nullable": true
|
||||
},
|
||||
"cliVersion": {
|
||||
"type": "string",
|
||||
"description": "The version of the CLI that is compatible with this project. Set this to enforce a particular set of versions of all fluence components",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
@ -1,20 +0,0 @@
|
||||
[[module]]
|
||||
name = "local_storage"
|
||||
load_from = "/Users/bebo/localdev/examples/marine-examples/url-downloader/target/wasm32-wasi/release/local_storage.wasm"
|
||||
logger_enabled = true
|
||||
|
||||
[module.wasi.mapped_dirs]
|
||||
sites = "./tmp"
|
||||
|
||||
[[module]]
|
||||
name = "curl_adapter"
|
||||
load_from = "/Users/bebo/localdev/examples/marine-examples/url-downloader/target/wasm32-wasi/release/curl_adapter.wasm"
|
||||
logger_enabled = true
|
||||
|
||||
[module.mounted_binaries]
|
||||
curl = "/usr/bin/curl"
|
||||
|
||||
[[module]]
|
||||
name = "url_downloader"
|
||||
load_from = "/Users/bebo/localdev/examples/marine-examples/url-downloader/target/wasm32-wasi/release/url_downloader.wasm"
|
||||
logger_enabled = true
|
@ -7,18 +7,10 @@
|
||||
version: 0
|
||||
hosts:
|
||||
defaultWorker:
|
||||
definition: bafkreicdordcic2qmd2pnacl5adffsuhwg4eleu4prcgaldjvzr6ds2f2m
|
||||
definition: bafkreiexli7oujwfx7tbcpdqg2t5d7h5vwlmbksvx5dnkw6mktldiwxgam
|
||||
installation_spells:
|
||||
- host_id: 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE
|
||||
spell_id: 039f4e06-923e-4a21-8814-8164fa9b137c
|
||||
worker_id: 12D3KooWKsxVXgnpL4wrTts9d49jiNSEN1auaxotdMYa4HpFS66g
|
||||
timestamp: 2023-04-23T07:00:05.549Z
|
||||
relayId: 12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA
|
||||
deals:
|
||||
defaultWorker:
|
||||
definition: bafkreicdordcic2qmd2pnacl5adffsuhwg4eleu4prcgaldjvzr6ds2f2m
|
||||
timestamp: 2023-04-23T07:01:18.682Z
|
||||
dealIdOriginal: "0x9d7503E13Bc2d3430536e3d5D635D8172141d884"
|
||||
dealId: 9d7503e13bc2d3430536e3d5d635d8172141d884
|
||||
chainNetwork: testnet
|
||||
chainNetworkId: 1313161555
|
||||
- host_id: 12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e
|
||||
spell_id: 53a712a3-90a9-4f64-b7fe-01ed275bc30d
|
||||
worker_id: 12D3KooWPHwmfqHY7wbxZZSbXyc8iM8UNnFXZMiwvEJ6aURih2ir
|
||||
timestamp: 2023-05-26T17:09:39.149Z
|
||||
relayId: 12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn
|
||||
|
@ -19,8 +19,8 @@ deals:
|
||||
hosts:
|
||||
defaultWorker:
|
||||
peerIds:
|
||||
- 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE #stage
|
||||
relays: stage
|
||||
- 12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e
|
||||
relays: kras
|
||||
services:
|
||||
url_downloader:
|
||||
get: service
|
||||
|
@ -6,36 +6,36 @@ import "@fluencelabs/spell/spell_service.aqua"
|
||||
import "workers.aqua"
|
||||
import "services.aqua"
|
||||
|
||||
export put, get
|
||||
-- export put, get
|
||||
export put_workers, get_workers, get_and_save_workers
|
||||
|
||||
func getWorkers() -> []Record:
|
||||
workersInfo <- getWorkersInfo()
|
||||
dealId = workersInfo.deals.defaultWorker.dealId
|
||||
workersOp <- resolveSubnetwork(dealId)
|
||||
<- workersOp!
|
||||
-- func getWorkers() -> []Record:
|
||||
-- workersInfo <- getWorkersInfo()
|
||||
-- dealId = workersInfo.deals.defaultWorker.dealId
|
||||
-- workersOp <- resolveSubnetwork(dealId)
|
||||
-- <- workersOp!
|
||||
|
||||
func put(file_name: string, file_content: []u8) -> string:
|
||||
workers <- getWorkers()
|
||||
w = workers[0]
|
||||
on w.metadata.peer_id via w.metadata.relay_id:
|
||||
res <- UrlDownloader.put(file_name, file_content)
|
||||
<- res
|
||||
-- func put(file_name: string, file_content: []u8) -> string:
|
||||
-- workers <- getWorkers()
|
||||
-- w = workers[0]
|
||||
-- on w.metadata.peer_id via w.metadata.relay_id:
|
||||
-- res <- UrlDownloader.put(file_name, file_content)
|
||||
-- <- res
|
||||
|
||||
|
||||
func get(file_name: string) -> []u8:
|
||||
workers <- getWorkers()
|
||||
w = workers[0]
|
||||
on w.metadata.peer_id via w.metadata.relay_id:
|
||||
res <- UrlDownloader.get(file_name)
|
||||
<- res
|
||||
-- func get(file_name: string) -> []u8:
|
||||
-- workers <- getWorkers()
|
||||
-- w = workers[0]
|
||||
-- on w.metadata.peer_id via w.metadata.relay_id:
|
||||
-- res <- UrlDownloader.get(file_name)
|
||||
-- <- res
|
||||
|
||||
func get_and_save(url: string, fname: string) -> string:
|
||||
workers <- getWorkers()
|
||||
w = workers[0]
|
||||
on w.metadata.peer_id via w.metadata.relay_id:
|
||||
res = UrlDownloader.get_n_save(url, fname)
|
||||
<- res
|
||||
-- func get_and_save(url: string, fname: string) -> string:
|
||||
-- workers <- getWorkers()
|
||||
-- w = workers[0]
|
||||
-- on w.metadata.peer_id via w.metadata.relay_id:
|
||||
-- res = UrlDownloader.get_n_save(url, fname)
|
||||
-- <- res
|
||||
|
||||
func put_workers(file_name: string, file_content: []u8) -> string:
|
||||
info <- getWorkersInfo()
|
||||
|
Loading…
Reference in New Issue
Block a user