From f6f330b07bd7eb810913e420639e2545d8695299 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 13 Apr 2026 18:06:58 -0400 Subject: [PATCH] Convert cmd_import, cmd_export, MigrateTranscriptProgress to access_local() These were the last Store::load() calls that should use the shared store. Remaining calls are intentional: fsck (needs both cached and fresh), persist.rs cached() infrastructure, view.rs read-only fallback, and access() bootstrap path. Co-Authored-By: Proof of Concept --- src/cli/admin.rs | 10 ++++++---- src/main.rs | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cli/admin.rs b/src/cli/admin.rs index 2f5cb3a..e07009b 100644 --- a/src/cli/admin.rs +++ b/src/cli/admin.rs @@ -349,12 +349,13 @@ pub async fn cmd_daily_check() -> Result<()> { Ok(()) } -pub fn cmd_import(files: &[String]) -> Result<()> { +pub async fn cmd_import(files: &[String]) -> Result<()> { if files.is_empty() { anyhow::bail!("import requires at least one file path"); } - let mut store = store::Store::load()?; + let arc = memory::access_local()?; + let mut store = arc.lock().await; let mut total_new = 0; let mut total_updated = 0; @@ -382,8 +383,9 @@ pub fn cmd_import(files: &[String]) -> Result<()> { Ok(()) } -pub fn cmd_export(files: &[String], export_all: bool) -> Result<()> { - let store = store::Store::load()?; +pub async fn cmd_export(files: &[String], export_all: bool) -> Result<()> { + let arc = memory::access_local()?; + let store = arc.lock().await; let targets: Vec = if export_all { let mut files: Vec = store.nodes.keys() diff --git a/src/main.rs b/src/main.rs index 2a95287..a3b52e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -463,11 +463,12 @@ impl Run for AdminCmd { Self::Fsck => cli::admin::cmd_fsck(), Self::Dedup { apply } => cli::admin::cmd_dedup(apply).await, Self::DailyCheck => cli::admin::cmd_daily_check().await, - Self::Import { files } => cli::admin::cmd_import(&files), - Self::Export { files, all } => cli::admin::cmd_export(&files, all), + Self::Import { files } => cli::admin::cmd_import(&files).await, + Self::Export { files, all } => cli::admin::cmd_export(&files, all).await, Self::LoadContext { stats } => cli::node::cmd_load_context(stats).await, Self::MigrateTranscriptProgress => { - let mut store = store::Store::load()?; + let arc = hippocampus::access_local()?; + let mut store = arc.lock().await; let count = store.migrate_transcript_progress()?; println!("Migrated {} transcript segment markers", count); Ok(())