store: wire up redb updates on mutations

Mutations (upsert_node, upsert_provenance, delete_node, rename_node)
now update redb indices atomically with capnp log appends, under the
same StoreLock.

Also removes dead cmd_import command and the parse.rs module it depended on.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-13 19:03:09 -04:00
parent a1accc7cd4
commit 9309de68fc
5 changed files with 23 additions and 214 deletions

View file

@ -315,45 +315,6 @@ pub async fn cmd_daily_check() -> Result<()> {
Ok(())
}
pub async fn cmd_import(files: &[String]) -> Result<()> {
if files.is_empty() {
anyhow::bail!("import requires at least one file path");
}
let arc = memory::access_local()?;
let mut store = arc.lock().await;
let mut count = 0;
for arg in files {
let path = std::path::PathBuf::from(arg);
let resolved = if path.exists() {
path
} else {
let mem_path = store::memory_dir().join(arg);
if !mem_path.exists() {
eprintln!("File not found: {}", arg);
continue;
}
mem_path
};
let filename = resolved.file_name().unwrap().to_string_lossy().to_string();
let content = std::fs::read_to_string(&resolved)?;
let units = store::parse_units(&filename, &content);
for unit in units {
store.upsert(&unit.key, &unit.content)?;
count += 1;
}
}
if count > 0 {
store.save()?;
}
println!("Imported {} memory units", count);
Ok(())
}
pub async fn cmd_status() -> Result<()> {
let result = memory::graph_topology(None).await
?;