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 <poc@bcachefs.org>
This commit is contained in:
parent
b8db8754be
commit
f6f330b07b
2 changed files with 10 additions and 7 deletions
|
|
@ -349,12 +349,13 @@ pub async fn cmd_daily_check() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cmd_import(files: &[String]) -> Result<()> {
|
pub async fn cmd_import(files: &[String]) -> Result<()> {
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
anyhow::bail!("import requires at least one file path");
|
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_new = 0;
|
||||||
let mut total_updated = 0;
|
let mut total_updated = 0;
|
||||||
|
|
||||||
|
|
@ -382,8 +383,9 @@ pub fn cmd_import(files: &[String]) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cmd_export(files: &[String], export_all: bool) -> Result<()> {
|
pub async fn cmd_export(files: &[String], export_all: bool) -> Result<()> {
|
||||||
let store = store::Store::load()?;
|
let arc = memory::access_local()?;
|
||||||
|
let store = arc.lock().await;
|
||||||
|
|
||||||
let targets: Vec<String> = if export_all {
|
let targets: Vec<String> = if export_all {
|
||||||
let mut files: Vec<String> = store.nodes.keys()
|
let mut files: Vec<String> = store.nodes.keys()
|
||||||
|
|
|
||||||
|
|
@ -463,11 +463,12 @@ impl Run for AdminCmd {
|
||||||
Self::Fsck => cli::admin::cmd_fsck(),
|
Self::Fsck => cli::admin::cmd_fsck(),
|
||||||
Self::Dedup { apply } => cli::admin::cmd_dedup(apply).await,
|
Self::Dedup { apply } => cli::admin::cmd_dedup(apply).await,
|
||||||
Self::DailyCheck => cli::admin::cmd_daily_check().await,
|
Self::DailyCheck => cli::admin::cmd_daily_check().await,
|
||||||
Self::Import { files } => cli::admin::cmd_import(&files),
|
Self::Import { files } => cli::admin::cmd_import(&files).await,
|
||||||
Self::Export { files, all } => cli::admin::cmd_export(&files, all),
|
Self::Export { files, all } => cli::admin::cmd_export(&files, all).await,
|
||||||
Self::LoadContext { stats } => cli::node::cmd_load_context(stats).await,
|
Self::LoadContext { stats } => cli::node::cmd_load_context(stats).await,
|
||||||
Self::MigrateTranscriptProgress => {
|
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()?;
|
let count = store.migrate_transcript_progress()?;
|
||||||
println!("Migrated {} transcript segment markers", count);
|
println!("Migrated {} transcript segment markers", count);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue