| 1 | #[path = "../../onestore/examples/support/concurrent.rs"] |
| 2 | mod concurrent; |
| 3 | #[path = "support/edit.rs"] |
| 4 | mod edit; |
| 5 | |
| 6 | use notebook::smb::{Client, Credentials}; |
| 7 | use std::{env, time::Duration}; |
| 8 | |
| 9 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 10 | let client = Client::connect( |
| 11 | &env::var("ONESTORE_SMB_LAB")?, |
| 12 | &env::var("ONESTORE_SMB_SHARE")?, |
| 13 | Credentials::default(), |
| 14 | Duration::from_secs(10), |
| 15 | )?; |
| 16 | let args: Vec<_> = env::args().skip(1).collect(); |
| 17 | concurrent::run( |
| 18 | &args, |
| 19 | |path| client.read(path, 256 * 1024 * 1024), |
| 20 | |path, source, space, object, range, replacement| { |
| 21 | client.commit_transaction( |
| 22 | path, |
| 23 | &edit::replaced(source, space, object, range, replacement)?, |
| 24 | ) |
| 25 | }, |
| 26 | ) |
| 27 | } |