mirror of
https://github.com/fluencelabs/examples
synced 2025-04-24 18:22:15 +00:00
bump version
This commit is contained in:
parent
07c07d9c40
commit
4eae93272e
@ -11,12 +11,12 @@ name = "process_files"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
marine-rs-sdk = { version="0.6.11", features=["logger"] }
|
||||
marine-rs-sdk = { version = "0.6.11", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
rand = "0.8.4"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.1.11"
|
||||
marine-rs-sdk-test = "0.2.0"
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use marine_rs_sdk::{marine, module_manifest, get_call_parameters};
|
||||
use std::path::{PathBuf, Path};
|
||||
use rand::Rng;
|
||||
use marine_rs_sdk::{get_call_parameters, marine, module_manifest};
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::Rng;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
module_manifest!();
|
||||
|
||||
pub fn main() { }
|
||||
pub fn main() {}
|
||||
|
||||
#[marine]
|
||||
pub struct SizeResult {
|
||||
@ -33,8 +33,16 @@ pub struct SizeResult {
|
||||
#[marine]
|
||||
pub fn file_size(file_path: String) -> SizeResult {
|
||||
match std::fs::read(file_path) {
|
||||
Ok(bytes) => SizeResult { size: bytes.len() as _, success: true, error: String::new() },
|
||||
Err(err) => SizeResult { size: 0, success: false, error: err.to_string() },
|
||||
Ok(bytes) => SizeResult {
|
||||
size: bytes.len() as _,
|
||||
success: true,
|
||||
error: String::new(),
|
||||
},
|
||||
Err(err) => SizeResult {
|
||||
size: 0,
|
||||
success: false,
|
||||
error: err.to_string(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,8 +64,16 @@ pub fn write_file_size(size: u32) -> WriteResult {
|
||||
let file = vault_dir().join(&name);
|
||||
let file_str = file.to_string_lossy().to_string();
|
||||
match std::fs::write(&file, size.to_string()) {
|
||||
Ok(_) => WriteResult { path: file_str, success: true, error: String::new() },
|
||||
Err(err) => WriteResult { path: String::new(), success: false, error: err.to_string() }
|
||||
Ok(_) => WriteResult {
|
||||
path: file_str,
|
||||
success: true,
|
||||
error: String::new(),
|
||||
},
|
||||
Err(err) => WriteResult {
|
||||
path: String::new(),
|
||||
success: false,
|
||||
error: err.to_string(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,4 +82,4 @@ fn vault_dir() -> PathBuf {
|
||||
let vault = Path::new("/tmp").join("vault").join(particle_id);
|
||||
|
||||
vault
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user