Skip to content

Commit 83dece2

Browse files
committed
style: Fix formatting (rustfmt)
1 parent 228099c commit 83dece2

3 files changed

Lines changed: 35 additions & 20 deletions

File tree

cli/src/cmd/snapshot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub async fn handle_snapshot_command(
1414
encryption: Option<(&str, &str)>,
1515
) -> Result<()> {
1616
// Resolve the source database
17-
let mut options = AgentFSOptions::resolve(&id_or_path)
18-
.context("Failed to resolve agent ID or path")?;
17+
let mut options =
18+
AgentFSOptions::resolve(&id_or_path).context("Failed to resolve agent ID or path")?;
1919

2020
// Apply encryption if provided
2121
if let Some((key, cipher)) = encryption {

cli/src/sandbox/linux.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,7 @@ async fn create_auto_snapshot(db_path: &Path) -> Result<()> {
493493

494494
// Generate snapshot filename with timestamp
495495
let timestamp = Utc::now().format("%Y%m%d_%H%M%S");
496-
let snapshot_name = format!(
497-
"snapshot_{}.db",
498-
timestamp
499-
);
496+
let snapshot_name = format!("snapshot_{}.db", timestamp);
500497

501498
let snapshot_path = db_path
502499
.parent()

sdk/rust/src/lib.rs

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,8 @@ impl AgentFS {
648648
}
649649
}
650650

651-
let source_path = source_path.ok_or_else(|| {
652-
Error::Snapshot("Cannot snapshot in-memory database".to_string())
653-
})?;
651+
let source_path = source_path
652+
.ok_or_else(|| Error::Snapshot("Cannot snapshot in-memory database".to_string()))?;
654653

655654
// Copy the database file
656655
std::fs::copy(&source_path, dest_path)?;
@@ -986,7 +985,11 @@ mod tests {
986985
.unwrap();
987986

988987
// Add KV data
989-
agentfs.kv.set("snapshot_key", &"snapshot_value").await.unwrap();
988+
agentfs
989+
.kv
990+
.set("snapshot_key", &"snapshot_value")
991+
.await
992+
.unwrap();
990993

991994
// Add filesystem data
992995
agentfs.fs.mkdir("/snapshot_dir", 0, 0).await.unwrap();
@@ -998,17 +1001,21 @@ mod tests {
9981001
file.pwrite(0, b"snapshot content").await.unwrap();
9991002

10001003
// Create snapshot
1001-
agentfs.snapshot(snapshot_path.to_str().unwrap()).await.unwrap();
1004+
agentfs
1005+
.snapshot(snapshot_path.to_str().unwrap())
1006+
.await
1007+
.unwrap();
10021008
}
10031009

10041010
// Verify snapshot file exists
10051011
assert!(snapshot_path.exists(), "Snapshot file should exist");
10061012

10071013
// Open snapshot and verify data
10081014
{
1009-
let snapshot_agentfs = AgentFS::open(AgentFSOptions::with_path(snapshot_path.to_str().unwrap()))
1010-
.await
1011-
.unwrap();
1015+
let snapshot_agentfs =
1016+
AgentFS::open(AgentFSOptions::with_path(snapshot_path.to_str().unwrap()))
1017+
.await
1018+
.unwrap();
10121019

10131020
// Verify KV data
10141021
let value: Option<String> = snapshot_agentfs.kv.get("snapshot_key").await.unwrap();
@@ -1019,7 +1026,11 @@ mod tests {
10191026
assert!(stats.is_some());
10201027
assert!(stats.unwrap().is_directory());
10211028

1022-
let content = snapshot_agentfs.fs.read_file("/snapshot_dir/file.txt").await.unwrap();
1029+
let content = snapshot_agentfs
1030+
.fs
1031+
.read_file("/snapshot_dir/file.txt")
1032+
.await
1033+
.unwrap();
10231034
assert_eq!(content, Some(b"snapshot content".to_vec()));
10241035
}
10251036

@@ -1052,23 +1063,30 @@ mod tests {
10521063
agentfs.kv.set("key1", &"value1").await.unwrap();
10531064

10541065
// Create snapshot
1055-
agentfs.snapshot(snapshot_path.to_str().unwrap()).await.unwrap();
1066+
agentfs
1067+
.snapshot(snapshot_path.to_str().unwrap())
1068+
.await
1069+
.unwrap();
10561070

10571071
// Modify source after snapshot
10581072
agentfs.kv.set("key2", &"value2").await.unwrap();
10591073

10601074
// Open snapshot and verify it doesn't have the new data
1061-
let snapshot_agentfs = AgentFS::open(AgentFSOptions::with_path(snapshot_path.to_str().unwrap()))
1062-
.await
1063-
.unwrap();
1075+
let snapshot_agentfs =
1076+
AgentFS::open(AgentFSOptions::with_path(snapshot_path.to_str().unwrap()))
1077+
.await
1078+
.unwrap();
10641079

10651080
// Snapshot should have key1
10661081
let value: Option<String> = snapshot_agentfs.kv.get("key1").await.unwrap();
10671082
assert_eq!(value, Some("value1".to_string()));
10681083

10691084
// Snapshot should NOT have key2 (added after snapshot)
10701085
let value: Option<String> = snapshot_agentfs.kv.get("key2").await.unwrap();
1071-
assert_eq!(value, None, "Snapshot should not contain data added after snapshot was created");
1086+
assert_eq!(
1087+
value, None,
1088+
"Snapshot should not contain data added after snapshot was created"
1089+
);
10721090

10731091
// Cleanup
10741092
drop(agentfs);

0 commit comments

Comments
 (0)