Implement insert and edit sessions (#7)

This commit is contained in:
Hermes Agent
2026-08-09 22:35:46 +00:00
parent dca07b7fbd
commit 0e4cbef944
10 changed files with 1158 additions and 1 deletions

View File

@@ -37,6 +37,10 @@ impl EntryPath {
&self.0
}
pub fn parent_directory(&self) -> DirectoryPath {
self.parent()
}
fn parent(&self) -> DirectoryPath {
DirectoryPath(self.0.parent().map_or_else(PathBuf::new, Path::to_path_buf))
}
@@ -511,6 +515,20 @@ impl Repository {
self.write_entry_with_checkpoint(path, ciphertext, |_| Ok(()))
}
pub fn remove_entry(&self, path: &EntryPath) -> Result<EncryptedEntry, RepositoryError> {
let original = self.read_entry(path)?;
let (parent, file_name) = self.open_entry_parent(path)?;
parent
.remove_file(&file_name)
.map_err(|error| io_error("remove encrypted entry", &path.0, error))?;
sync_directory(&parent, &path.parent().0).map_err(|_| {
RepositoryError::DurabilityUncertain {
path: path.0.clone(),
}
})?;
Ok(original)
}
fn write_entry_with_checkpoint<F>(
&self,
path: &EntryPath,