mirror of
https://github.com/fluencelabs/examples
synced 2025-06-26 00:01:33 +00:00
update to marine, marine-test, bump versions
This commit is contained in:
@ -10,5 +10,5 @@ name = "ipfs_pure"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence = { version = "=0.5.0", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
fluence = { version = "0.6.9", features = ["logger"] }
|
||||
log = "0.4.14"
|
@ -16,7 +16,7 @@
|
||||
|
||||
#![allow(improper_ctypes)]
|
||||
|
||||
use fluence::fce;
|
||||
use fluence::marine;
|
||||
use fluence::module_manifest;
|
||||
use fluence::WasmLoggerBuilder;
|
||||
|
||||
@ -34,12 +34,12 @@ pub fn main() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn invoke() -> String {
|
||||
"IPFS_RPC wasm example, it allows to:\ninvoke\nput\nget".to_string()
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn put(file_content: Vec<u8>) -> String {
|
||||
log::info!("put called with {:?}", file_content);
|
||||
|
||||
@ -50,18 +50,18 @@ pub fn put(file_content: Vec<u8>) -> String {
|
||||
return format!("file can't be written: {}", e);
|
||||
}
|
||||
|
||||
unsafe { ipfs_put(rpc_tmp_filepath) }
|
||||
ipfs_put(rpc_tmp_filepath)
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
pub fn get(hash: String) -> Vec<u8> {
|
||||
log::info!("get called with hash: {}", hash);
|
||||
|
||||
let file_path = unsafe { ipfs_get(hash) };
|
||||
let file_path = ipfs_get(hash);
|
||||
fs::read(file_path).unwrap_or_else(|_| b"error while reading file".to_vec())
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[marine]
|
||||
#[link(wasm_import_module = "ipfs_effector")]
|
||||
extern "C" {
|
||||
/// Put provided file to ipfs, return ipfs hash of the file.
|
||||
|
Reference in New Issue
Block a user