From c2c22ca06b9ec796f402032d1988e871abca50bc Mon Sep 17 00:00:00 2001 From: vms Date: Sat, 5 Feb 2022 02:15:59 +0300 Subject: [PATCH] update url-downloader --- build/config.gypi | 347 ++++++++++++++++++ {hello-world => greeting}/Cargo.lock | 0 {hello-world => greeting}/Cargo.toml | 0 {hello-world => greeting}/Config.toml | 0 greeting/artifacts/greeting.json | 1 + .../artifacts/greeting.wasm | Bin {hello-world => greeting}/build.sh | 0 {hello-world => greeting}/src/main.rs | 0 url-downloader/README.md | 15 + url-downloader/artifacts/curl_adapter.json | 7 + url-downloader/artifacts/curl_adapter.wasm | Bin 95158 -> 95158 bytes url-downloader/artifacts/facade.json | 1 + url-downloader/artifacts/facade.wasm | Bin 90468 -> 90468 bytes url-downloader/artifacts/local_storage.json | 12 + url-downloader/artifacts/local_storage.wasm | Bin 108750 -> 109004 bytes url-downloader/build.sh | 42 +-- url-downloader/compose.air | 13 + url-downloader/curl_adapter/Cargo.toml | 2 +- url-downloader/curl_adapter/src/main.rs | 4 +- url-downloader/deploy.sh | 13 + url-downloader/deploy_separate.sh | 16 + url-downloader/download.air | 10 + url-downloader/facade/Cargo.toml | 4 +- url-downloader/facade/src/main.rs | 2 +- url-downloader/local_storage/Cargo.toml | 5 +- url-downloader/local_storage/src/main.rs | 4 +- url-downloader/repl_config.toml | 21 ++ url-downloader/sites/asd | 6 - 28 files changed, 487 insertions(+), 38 deletions(-) create mode 100644 build/config.gypi rename {hello-world => greeting}/Cargo.lock (100%) rename {hello-world => greeting}/Cargo.toml (100%) rename {hello-world => greeting}/Config.toml (100%) create mode 100644 greeting/artifacts/greeting.json rename {hello-world => greeting}/artifacts/greeting.wasm (100%) rename {hello-world => greeting}/build.sh (100%) rename {hello-world => greeting}/src/main.rs (100%) create mode 100644 url-downloader/README.md create mode 100644 url-downloader/artifacts/curl_adapter.json create mode 100644 url-downloader/artifacts/facade.json create mode 100644 url-downloader/artifacts/local_storage.json create mode 100644 url-downloader/compose.air create mode 100755 url-downloader/deploy.sh create mode 100755 url-downloader/deploy_separate.sh create mode 100644 url-downloader/download.air create mode 100644 url-downloader/repl_config.toml delete mode 100644 url-downloader/sites/asd diff --git a/build/config.gypi b/build/config.gypi new file mode 100644 index 0000000..d2cbe2f --- /dev/null +++ b/build/config.gypi @@ -0,0 +1,347 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "asan": 0, + "coverage": "false", + "dcheck_always_on": 0, + "debug_nghttp2": "false", + "debug_node": "false", + "enable_lto": "false", + "enable_pgo_generate": "false", + "enable_pgo_use": "false", + "error_on_warn": "false", + "force_dynamic_crt": 0, + "host_arch": "x64", + "icu_data_in": "../../deps/icu-tmp/icudt69l.dat", + "icu_endianness": "l", + "icu_gyp_path": "tools/icu/icu-generic.gyp", + "icu_path": "deps/icu-small", + "icu_small": "false", + "icu_ver_major": "69", + "is_debug": 0, + "llvm_version": "11.0", + "napi_build_version": "8", + "node_byteorder": "little", + "node_debug_lib": "false", + "node_enable_d8": "false", + "node_install_npm": "true", + "node_library_files": [ + "lib/constants.js", + "lib/net.js", + "lib/trace_events.js", + "lib/events.js", + "lib/repl.js", + "lib/util.js", + "lib/dgram.js", + "lib/vm.js", + "lib/stream.js", + "lib/child_process.js", + "lib/assert.js", + "lib/_tls_wrap.js", + "lib/http2.js", + "lib/inspector.js", + "lib/os.js", + "lib/_http_server.js", + "lib/console.js", + "lib/perf_hooks.js", + "lib/readline.js", + "lib/punycode.js", + "lib/_http_incoming.js", + "lib/https.js", + "lib/_stream_wrap.js", + "lib/domain.js", + "lib/dns.js", + "lib/_http_client.js", + "lib/diagnostics_channel.js", + "lib/tty.js", + "lib/_http_agent.js", + "lib/timers.js", + "lib/_http_outgoing.js", + "lib/querystring.js", + "lib/_tls_common.js", + "lib/module.js", + "lib/_stream_passthrough.js", + "lib/_stream_transform.js", + "lib/worker_threads.js", + "lib/sys.js", + "lib/_stream_duplex.js", + "lib/path.js", + "lib/_http_common.js", + "lib/string_decoder.js", + "lib/cluster.js", + "lib/v8.js", + "lib/crypto.js", + "lib/wasi.js", + "lib/_stream_readable.js", + "lib/zlib.js", + "lib/url.js", + "lib/tls.js", + "lib/_stream_writable.js", + "lib/async_hooks.js", + "lib/process.js", + "lib/http.js", + "lib/buffer.js", + "lib/fs.js", + "lib/util/types.js", + "lib/timers/promises.js", + "lib/path/win32.js", + "lib/path/posix.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", + "lib/stream/web.js", + "lib/internal/constants.js", + "lib/internal/abort_controller.js", + "lib/internal/net.js", + "lib/internal/v8_prof_processor.js", + "lib/internal/event_target.js", + "lib/internal/inspector_async_hook.js", + "lib/internal/validators.js", + "lib/internal/linkedlist.js", + "lib/internal/cli_table.js", + "lib/internal/repl.js", + "lib/internal/util.js", + "lib/internal/histogram.js", + "lib/internal/error_serdes.js", + "lib/internal/dgram.js", + "lib/internal/child_process.js", + "lib/internal/assert.js", + "lib/internal/fixed_queue.js", + "lib/internal/blocklist.js", + "lib/internal/v8_prof_polyfill.js", + "lib/internal/options.js", + "lib/internal/worker.js", + "lib/internal/dtrace.js", + "lib/internal/idna.js", + "lib/internal/watchdog.js", + "lib/internal/encoding.js", + "lib/internal/tty.js", + "lib/internal/freeze_intrinsics.js", + "lib/internal/timers.js", + "lib/internal/heap_utils.js", + "lib/internal/querystring.js", + "lib/internal/js_stream_socket.js", + "lib/internal/errors.js", + "lib/internal/priority_queue.js", + "lib/internal/freelist.js", + "lib/internal/blob.js", + "lib/internal/socket_list.js", + "lib/internal/socketaddress.js", + "lib/internal/stream_base_commons.js", + "lib/internal/url.js", + "lib/internal/async_hooks.js", + "lib/internal/http.js", + "lib/internal/buffer.js", + "lib/internal/trace_events_async_hooks.js", + "lib/internal/crypto/sig.js", + "lib/internal/crypto/rsa.js", + "lib/internal/crypto/aes.js", + "lib/internal/crypto/util.js", + "lib/internal/crypto/scrypt.js", + "lib/internal/crypto/random.js", + "lib/internal/crypto/keys.js", + "lib/internal/crypto/x509.js", + "lib/internal/crypto/certificate.js", + "lib/internal/crypto/ec.js", + "lib/internal/crypto/keygen.js", + "lib/internal/crypto/mac.js", + "lib/internal/crypto/diffiehellman.js", + "lib/internal/crypto/hkdf.js", + "lib/internal/crypto/cipher.js", + "lib/internal/crypto/hash.js", + "lib/internal/crypto/pbkdf2.js", + "lib/internal/crypto/webcrypto.js", + "lib/internal/crypto/dsa.js", + "lib/internal/crypto/hashnames.js", + "lib/internal/cluster/shared_handle.js", + "lib/internal/cluster/round_robin_handle.js", + "lib/internal/cluster/worker.js", + "lib/internal/cluster/primary.js", + "lib/internal/cluster/utils.js", + "lib/internal/cluster/child.js", + "lib/internal/webstreams/util.js", + "lib/internal/webstreams/writablestream.js", + "lib/internal/webstreams/readablestream.js", + "lib/internal/webstreams/queuingstrategies.js", + "lib/internal/webstreams/encoding.js", + "lib/internal/webstreams/transformstream.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/bootstrap/loaders.js", + "lib/internal/bootstrap/pre_execution.js", + "lib/internal/bootstrap/node.js", + "lib/internal/bootstrap/environment.js", + "lib/internal/bootstrap/switches/does_not_own_process_state.js", + "lib/internal/bootstrap/switches/is_not_main_thread.js", + "lib/internal/bootstrap/switches/does_own_process_state.js", + "lib/internal/bootstrap/switches/is_main_thread.js", + "lib/internal/test/binding.js", + "lib/internal/test/transfer.js", + "lib/internal/util/types.js", + "lib/internal/util/inspector.js", + "lib/internal/util/comparisons.js", + "lib/internal/util/debuglog.js", + "lib/internal/util/inspect.js", + "lib/internal/util/iterable_weak_map.js", + "lib/internal/streams/add-abort-signal.js", + "lib/internal/streams/compose.js", + "lib/internal/streams/duplexify.js", + "lib/internal/streams/destroy.js", + "lib/internal/streams/legacy.js", + "lib/internal/streams/passthrough.js", + "lib/internal/streams/readable.js", + "lib/internal/streams/from.js", + "lib/internal/streams/writable.js", + "lib/internal/streams/state.js", + "lib/internal/streams/buffer_list.js", + "lib/internal/streams/end-of-stream.js", + "lib/internal/streams/utils.js", + "lib/internal/streams/transform.js", + "lib/internal/streams/lazy_transform.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/pipeline.js", + "lib/internal/readline/utils.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/readline/callbacks.js", + "lib/internal/repl/history.js", + "lib/internal/repl/utils.js", + "lib/internal/repl/await.js", + "lib/internal/legacy/processbinding.js", + "lib/internal/assert/calltracker.js", + "lib/internal/assert/assertion_error.js", + "lib/internal/http2/util.js", + "lib/internal/http2/core.js", + "lib/internal/http2/compat.js", + "lib/internal/per_context/messageport.js", + "lib/internal/per_context/primordials.js", + "lib/internal/per_context/domexception.js", + "lib/internal/vm/module.js", + "lib/internal/tls/secure-pair.js", + "lib/internal/tls/parse-cert-string.js", + "lib/internal/tls/secure-context.js", + "lib/internal/child_process/serialization.js", + "lib/internal/debugger/inspect_repl.js", + "lib/internal/debugger/inspect_client.js", + "lib/internal/debugger/inspect.js", + "lib/internal/worker/io.js", + "lib/internal/worker/js_transferable.js", + "lib/internal/main/repl.js", + "lib/internal/main/print_help.js", + "lib/internal/main/eval_string.js", + "lib/internal/main/check_syntax.js", + "lib/internal/main/prof_process.js", + "lib/internal/main/worker_thread.js", + "lib/internal/main/inspect.js", + "lib/internal/main/eval_stdin.js", + "lib/internal/main/run_main_module.js", + "lib/internal/modules/run_main.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/esm/module_job.js", + "lib/internal/modules/esm/get_source.js", + "lib/internal/modules/esm/translators.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/create_dynamic_module.js", + "lib/internal/modules/esm/load.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/get_format.js", + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/cjs/helpers.js", + "lib/internal/modules/cjs/loader.js", + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/source_map/source_map_cache.js", + "lib/internal/dns/promises.js", + "lib/internal/dns/utils.js", + "lib/internal/fs/watchers.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/read_file_context.js", + "lib/internal/fs/rimraf.js", + "lib/internal/fs/sync_write_stream.js", + "lib/internal/fs/dir.js", + "lib/internal/fs/streams.js", + "lib/internal/fs/utils.js", + "lib/internal/fs/cp/cp.js", + "lib/internal/fs/cp/cp-sync.js", + "lib/internal/perf/nodetiming.js", + "lib/internal/perf/usertiming.js", + "lib/internal/perf/performance_entry.js", + "lib/internal/perf/performance.js", + "lib/internal/perf/timerify.js", + "lib/internal/perf/utils.js", + "lib/internal/perf/observe.js", + "lib/internal/perf/event_loop_delay.js", + "lib/internal/perf/event_loop_utilization.js", + "lib/internal/policy/manifest.js", + "lib/internal/policy/sri.js", + "lib/internal/process/task_queues.js", + "lib/internal/process/per_thread.js", + "lib/internal/process/warning.js", + "lib/internal/process/policy.js", + "lib/internal/process/promises.js", + "lib/internal/process/signal.js", + "lib/internal/process/execution.js", + "lib/internal/process/esm_loader.js", + "lib/internal/process/report.js", + "lib/internal/process/worker_thread_only.js", + "lib/internal/console/constructor.js", + "lib/internal/console/global.js", + "lib/assert/strict.js", + "lib/dns/promises.js", + "lib/fs/promises.js" + ], + "node_module_version": 93, + "node_no_browser_globals": "false", + "node_prefix": "/", + "node_release_urlbase": "https://nodejs.org/download/release/", + "node_shared": "false", + "node_shared_brotli": "false", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_nghttp2": "false", + "node_shared_nghttp3": "false", + "node_shared_ngtcp2": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_target_type": "executable", + "node_use_bundled_v8": "true", + "node_use_dtrace": "true", + "node_use_etw": "false", + "node_use_node_code_cache": "true", + "node_use_node_snapshot": "true", + "node_use_openssl": "true", + "node_use_v8_platform": "true", + "node_with_ltcg": "false", + "node_without_node_options": "false", + "openssl_fips": "", + "openssl_is_fips": "false", + "openssl_quic": "true", + "ossfuzz": "false", + "shlib_suffix": "93.dylib", + "target_arch": "x64", + "v8_enable_31bit_smis_on_64bit_arch": 0, + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 1, + "v8_enable_inspector": 1, + "v8_enable_lite_mode": 0, + "v8_enable_object_print": 1, + "v8_enable_pointer_compression": 0, + "v8_enable_webassembly": 1, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 1, + "v8_promise_internal_field_count": 1, + "v8_random_seed": 0, + "v8_trace_maps": 0, + "v8_use_siphash": 1, + "want_separate_host_toolset": 0, + "xcode_version": "11.0", + "nodedir": "/Users/mike/Library/Caches/node-gyp/16.13.2", + "standalone_static_library": 1 + } +} diff --git a/hello-world/Cargo.lock b/greeting/Cargo.lock similarity index 100% rename from hello-world/Cargo.lock rename to greeting/Cargo.lock diff --git a/hello-world/Cargo.toml b/greeting/Cargo.toml similarity index 100% rename from hello-world/Cargo.toml rename to greeting/Cargo.toml diff --git a/hello-world/Config.toml b/greeting/Config.toml similarity index 100% rename from hello-world/Config.toml rename to greeting/Config.toml diff --git a/greeting/artifacts/greeting.json b/greeting/artifacts/greeting.json new file mode 100644 index 0000000..517809e --- /dev/null +++ b/greeting/artifacts/greeting.json @@ -0,0 +1 @@ +{"name": "greeting"} diff --git a/hello-world/artifacts/greeting.wasm b/greeting/artifacts/greeting.wasm similarity index 100% rename from hello-world/artifacts/greeting.wasm rename to greeting/artifacts/greeting.wasm diff --git a/hello-world/build.sh b/greeting/build.sh similarity index 100% rename from hello-world/build.sh rename to greeting/build.sh diff --git a/hello-world/src/main.rs b/greeting/src/main.rs similarity index 100% rename from hello-world/src/main.rs rename to greeting/src/main.rs diff --git a/url-downloader/README.md b/url-downloader/README.md new file mode 100644 index 0000000..6918459 --- /dev/null +++ b/url-downloader/README.md @@ -0,0 +1,15 @@ +# Download file to disk + +Example that shows how to work with disk access and how to link several Wasm modules into a service. + +# Build & deploy it + +```shell +./deploy.sh +``` + +# Call it + +```shell +fldist run_air -p download.air -d '{"service": "f7db6966-2d75-4424-812e-85e2ec5cb61b"}' +``` diff --git a/url-downloader/artifacts/curl_adapter.json b/url-downloader/artifacts/curl_adapter.json new file mode 100644 index 0000000..9de081f --- /dev/null +++ b/url-downloader/artifacts/curl_adapter.json @@ -0,0 +1,7 @@ +{ + "name": "curl_adapter", + "mountedBinaries": + { + "curl": "/usr/bin/curl" + } +} diff --git a/url-downloader/artifacts/curl_adapter.wasm b/url-downloader/artifacts/curl_adapter.wasm index eecdd4df3c0e0830e5ec5fe9d2d527a60f41c25d..332f7f5e4f7db932048bcd2fe696b445ce8f8610 100755 GIT binary patch delta 33 pcmdn?oORoC)`l&Na|-y4jI9ift&9xxj0{YS4NbPME@0$l1_07w3UL4c delta 33 pcmdn?oORoC)`l&Na|-wk&8tOfCgw(Fh6dX+q8b0N0szgq3e*4q delta 33 pcmaEIi1o=K)`l&Nkcn9AEimX?caqB|&B`qLu5uL zq%vRHdh+}R=J&*kc77xC%eAN56Z7oWtfVx%&5>PgukDvjgl~RAUqRuELnk@8dE%i^9Q&*-N64 zF=lPo`$Jfcu%oOB&-6OP4zi1Q#jzj%#%BD5GHk>{EW@aUtQ=R^S`@LE&)F7CXO)=2 zCa~GKhx?d;$ZPB~)?&zNtYEX*>&vm6z2^1n%1OdO#WAFBt0s~nj|@ea#Nrhxf>qy) z_mLDy-tN5XzQ+^W)h&Jw8r#YtH1?5Se`Y(B!k2s`vzysHEyUey2=VZ4U{WNr`$&1a zx?ApT+>THWjezX$?}rD@Q1faJk1{5izSU!rJHpf(z4Lran91y}cq?vl36rZ-+si%twWSEw^zrJ} zm-`aBd!MJ!C->??k_UHrdTWSpumEGmB-< zn4!pNW=XD4+xCw^g>zW{chJ0zB83>}pLx5Pl+%la*vi848cD8Ie;zQn@l}KvOmxta zW@d_an)0pKYNHMx*bG(ipWA&$jp;)gr{8u}C?2P}HpC@*!1BZ;Hv3kfH8v75W z(RpoX2XC^I?}#I0w2LE}8c^xHJ93->57g|eI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;5h$i26YqP@}Fj4 z7_Re#nHY@k_?nr-b@fbitVHcKHA7r?$1urEVP*2 zw^p*A3sYHR7eRZ**c3-*hK*8T8gIP-0qv)=rvGL}%QKk4K0YO9CKGXzlr^D*@iFtL z4y<1QU-=!@Lj-M0etrR3v004&RfKrnQ$=gc=EGD((uZKZfSgmQQp|O22wzAW=JAAu zXwrN>^Aq9!4+}5gc?WObjQ8hsdzSNg9DUeIosC~~ zWMpzUxivB|YQ*rw@NT^-T>Rf$LK3gy8B540tNENIu(Vmj{_z9F+JF5%@g6_E1fAvg zS+rgeTP%g;`E|_A){DHgo+&PEvK*O76tyWiA21J_EiEa>k(iNPNxs(d=^s|#zye3| zF-y?W@F8n8lFwg4T7Ja05#^>IGhdBjx-E%ZVN1%%bYySjKP|$i|k`1ob$fKU1AWr*^vVy>d?3e;-;{W7X9HN5@1h-|xsxujxWx*B_vvsF!G_P-6zJF1$raR0 z?&o(`U_4y`xn+1$KFHGe#7w-v1InqxJjAW#Xd)kGZTSzQ5%`47o;cF(NSknkxg`## zB6F0vCFiE6PdKKN-(60uj`P#y=to6AWF@uiCwbLM45gyqxPmU2(`-23IfP2ftyS>g zA63xyGrX<>X;l9^twOwfj`h|RT(b)PIL~*iB2pK)X*Eiy2VT4yvDE+RJTLPvR#Q*@ iMOEuH^j>0)i0;v?Ymcsxow`MJjf#k=TDlfp<^KWYa(1-< diff --git a/url-downloader/build.sh b/url-downloader/build.sh index a81a671..2d8702a 100755 --- a/url-downloader/build.sh +++ b/url-downloader/build.sh @@ -1,26 +1,26 @@ -#!/bin/sh +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +# This script builds all subprojects and puts all created Wasm modules in one dir ( - cd local_storage || exit; - cargo update --aggressive; - marine build --release; + cd local_storage + cargo update --aggressive + marine build --release +) +( + cd curl_adapter + cargo update --aggressive + marine build --release +) +( + cd facade + cargo update --aggressive + marine build --release ) -( - cd curl_adapter || exit; - cargo update --aggressive; - marine build --release; -) - -( - cd facade || exit; - cargo update --aggressive; - marine build --release; -) - -rm -f artifacts/* || true +mkdir -p sites mkdir -p artifacts - -cp ./local_storage/target/wasm32-wasi/release/local_storage.wasm artifacts/ -cp ./curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/ -cp ./facade/target/wasm32-wasi/release/facade.wasm artifacts/ +rm -f artifacts/*.wasm +cp local_storage/target/wasm32-wasi/release/local_storage.wasm artifacts/ +cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/ +cp facade/target/wasm32-wasi/release/facade.wasm artifacts/ diff --git a/url-downloader/compose.air b/url-downloader/compose.air new file mode 100644 index 0000000..b568a53 --- /dev/null +++ b/url-downloader/compose.air @@ -0,0 +1,13 @@ +(xor + (seq + (seq + (seq + (call relay (curl "download") ["https://fluence.network/img/svg/logo_new.svg"] contents) + (call relay (storage "put") ["logo.svg" contents.$.stdout!] ret_code) + ) + (call relay (storage "get") ["logo.svg"] bytes) + ) + (call %init_peer_id% (returnService "run") [ret_code bytes]) + ) + (call %init_peer_id% (returnService "run") [%last_error%]) +) diff --git a/url-downloader/curl_adapter/Cargo.toml b/url-downloader/curl_adapter/Cargo.toml index 88a30e3..2f97a98 100644 --- a/url-downloader/curl_adapter/Cargo.toml +++ b/url-downloader/curl_adapter/Cargo.toml @@ -10,5 +10,5 @@ path = "src/main.rs" name = "curl_adapter" [dependencies] -marine-rs-sdk ={ version = "0.6.13", features = ["logger"] } +marine-rs-sdk = { version = "0.6.10", features = ["logger"] } log = "0.4.8" diff --git a/url-downloader/curl_adapter/src/main.rs b/url-downloader/curl_adapter/src/main.rs index 8326690..8b279f7 100644 --- a/url-downloader/curl_adapter/src/main.rs +++ b/url-downloader/curl_adapter/src/main.rs @@ -1,5 +1,5 @@ /* - * Copyright 2020 Fluence Labs Limited + * Copyright 2021 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ use marine_rs_sdk::marine; use marine_rs_sdk::module_manifest; -use marine_rs_sdk::WasmLoggerBuilder; use marine_rs_sdk::MountedBinaryResult; +use marine_rs_sdk::WasmLoggerBuilder; module_manifest!(); diff --git a/url-downloader/deploy.sh b/url-downloader/deploy.sh new file mode 100755 index 0000000..10fd5b1 --- /dev/null +++ b/url-downloader/deploy.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail + +# build wasms +./build.sh + +( + cd artifacts + fldist new_service --name "url_downloader" --modules \ + curl_adapter.wasm:curl_adapter.json \ + local_storage.wasm:local_storage.json \ + facade.wasm:facade.json +) diff --git a/url-downloader/deploy_separate.sh b/url-downloader/deploy_separate.sh new file mode 100755 index 0000000..d846e56 --- /dev/null +++ b/url-downloader/deploy_separate.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail + +./build.sh + +echo "Deploying storage" +( + cd artifacts + fldist new_service --name "local_storage" --modules local_storage.wasm:local_storage.json +) + +echo "\n\nDeploying curl" +( + cd artifacts + fldist new_service --name "curl_adapter" --modules curl_adapter.wasm:curl_adapter.json +) diff --git a/url-downloader/download.air b/url-downloader/download.air new file mode 100644 index 0000000..d8a1334 --- /dev/null +++ b/url-downloader/download.air @@ -0,0 +1,10 @@ +(xor + (seq + (seq + (call relay (service "get_n_save") ["https://fluence.network/img/svg/logo_new.svg" "logo.svg"] ret_code) + (call relay (service "load_file") ["logo.svg"] bytes) + ) + (call %init_peer_id% (returnService "run") [ret_code bytes]) + ) + (call %init_peer_id% (returnService "run") [%last_error%]) +) diff --git a/url-downloader/facade/Cargo.toml b/url-downloader/facade/Cargo.toml index 62e3a4e..0ad5b14 100644 --- a/url-downloader/facade/Cargo.toml +++ b/url-downloader/facade/Cargo.toml @@ -10,6 +10,6 @@ name = "facade" path = "src/main.rs" [dependencies] -marine-rs-sdk ={ version = "0.6.13", features = ["logger"] } +marine-rs-sdk = { version = "0.6.10", features = ["logger"] } anyhow = "1.0.31" -log = "0.4.8" +log = "0.4.8" \ No newline at end of file diff --git a/url-downloader/facade/src/main.rs b/url-downloader/facade/src/main.rs index 848b3ec..548a92e 100644 --- a/url-downloader/facade/src/main.rs +++ b/url-downloader/facade/src/main.rs @@ -1,5 +1,5 @@ /* - * Copyright 2020 Fluence Labs Limited + * Copyright 2021 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/url-downloader/local_storage/Cargo.toml b/url-downloader/local_storage/Cargo.toml index a4f6293..18f2f84 100644 --- a/url-downloader/local_storage/Cargo.toml +++ b/url-downloader/local_storage/Cargo.toml @@ -10,7 +10,6 @@ name = "local_storage" path = "src/main.rs" [dependencies] -marine-rs-sdk ={ version = "0.6.13", features = ["logger"] } -wasm-tracing-allocator = "0.1.0" - +marine-rs-sdk = { version = "0.6.10", features = ["logger"] } +wasm-tracing-allocator = "0.1.1" log = "0.4.8" diff --git a/url-downloader/local_storage/src/main.rs b/url-downloader/local_storage/src/main.rs index 34fba98..4ba7fde 100644 --- a/url-downloader/local_storage/src/main.rs +++ b/url-downloader/local_storage/src/main.rs @@ -1,5 +1,5 @@ /* - * Copyright 2020 Fluence Labs Limited + * Copyright 2021 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ pub fn put(name: String, file_content: Vec) -> String { log::info!("put called with file name {}\n", name); let rpc_tmp_filepath = format!("{}{}", SITES_DIR, name); - let result = fs::write(PathBuf::from(rpc_tmp_filepath), file_content); + let result = fs::write(PathBuf::from(rpc_tmp_filepath.clone()), file_content); if let Err(e) = result { return format!("file can't be written: {}", e); } diff --git a/url-downloader/repl_config.toml b/url-downloader/repl_config.toml new file mode 100644 index 0000000..6701450 --- /dev/null +++ b/url-downloader/repl_config.toml @@ -0,0 +1,21 @@ +modules_dir = "artifacts/" + +[[module]] +name = "local_storage" +logger_enabled = true + +[module.wasi] +preopened_files = ["."] +# this is where files will be stored +mapped_dirs = { "sites" = "." } + +[[module]] +name = "curl_adapter" +logger_enabled = true + +[module.mounted_binaries] +curl = "/usr/bin/curl" + +[[module]] +name = "facade" +logger_enabled = true diff --git a/url-downloader/sites/asd b/url-downloader/sites/asd deleted file mode 100644 index 6c68f27..0000000 --- a/url-downloader/sites/asd +++ /dev/null @@ -1,6 +0,0 @@ - -301 Moved -

301 Moved

-The document has moved -here. -