bump version

This commit is contained in:
boneyard93501 2021-09-01 18:32:57 -05:00
parent 07c07d9c40
commit 4eae93272e
2 changed files with 27 additions and 11 deletions

View File

@ -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"

View File

@ -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
}
}