diff --git a/libmarlin/src/db/mod.rs b/libmarlin/src/db/mod.rs index eae911c..cfc454e 100644 --- a/libmarlin/src/db/mod.rs +++ b/libmarlin/src/db/mod.rs @@ -20,12 +20,12 @@ use tracing::{debug, info, warn}; use crate::utils::to_db_path; -/* ─── schema version ───────────────────────────────────────────────── */ +/* ─── schema version ─────────────────────────────────────────────── */ /// Current library schema version. pub const SCHEMA_VERSION: i32 = MIGRATIONS.len() as i32; -/* ─── embedded migrations ─────────────────────────────────────────── */ +/* ─── embedded migrations ────────────────────────────────────────── */ const MIGRATIONS: &[(&str, &str)] = &[ ( @@ -70,7 +70,7 @@ pub fn current_schema_version(conn: &Connection) -> Result { Ok(version) } -/* ─── connection bootstrap ────────────────────────────────────────── */ +/* ─── connection bootstrap ───────────────────────────────────────── */ pub fn open>(db_path: P) -> Result { let db_path_ref = db_path.as_ref(); @@ -87,7 +87,7 @@ pub fn open>(db_path: P) -> Result { Ok(conn) } -/* ─── migration runner ────────────────────────────────────────────── */ +/* ─── migration runner ───────────────────────────────────────────── */ pub(crate) fn apply_migrations(conn: &mut Connection) -> Result<()> { // Ensure schema_version bookkeeping table exists @@ -136,7 +136,7 @@ pub(crate) fn apply_migrations(conn: &mut Connection) -> Result<()> { tx.commit()?; - // sanity – warn if any embedded migration got skipped + // Sanity – warn if any embedded migration got skipped let mut missing = Vec::new(); for (fname, _) in MIGRATIONS { let v: i64 = fname.split('_').next().unwrap().parse().unwrap(); @@ -168,7 +168,7 @@ pub(crate) fn apply_migrations(conn: &mut Connection) -> Result<()> { Ok(()) } -/* ─── tag helpers ─────────────────────────────────────────────────── */ +/* ─── tag helpers ────────────────────────────────────────────────── */ pub fn ensure_tag_path(conn: &Connection, path: &str) -> Result { let mut parent: Option = None; @@ -197,7 +197,7 @@ pub fn file_id(conn: &Connection, path: &str) -> Result { .map_err(|_| anyhow::anyhow!("file not indexed: {}", path)) } -/* ─── attributes ──────────────────────────────────────────────────── */ +/* ─── attributes ─────────────────────────────────────────────────── */ pub fn upsert_attr(conn: &Connection, file_id: i64, key: &str, value: &str) -> Result<()> { conn.execute( @@ -211,7 +211,7 @@ pub fn upsert_attr(conn: &Connection, file_id: i64, key: &str, value: &str) -> R Ok(()) } -/* ─── links ───────────────────────────────────────────────────────── */ +/* ─── links ──────────────────────────────────────────────────────── */ pub fn add_link( conn: &Connection, @@ -308,7 +308,7 @@ pub fn find_backlinks(conn: &Connection, pattern: &str) -> Result Result { conn.execute( @@ -373,7 +373,7 @@ pub fn view_query(conn: &Connection, name: &str) -> Result { .context(format!("no view called '{}'", name)) } -/* ─── dirty‐scan helpers ─────────────────────────────────────────── */ +/* ─── dirty-scan helpers ────────────────────────────────────────── */ /// Mark a file as “dirty” so it’ll be picked up by `scan_dirty`. pub fn mark_dirty(conn: &Connection, file_id: i64) -> Result<()> { @@ -398,7 +398,7 @@ pub fn take_dirty(conn: &Connection) -> Result> { Ok(ids) } -/* ─── rename helpers ────────────────────────────────────────────── */ +/* ─── rename helpers ───────────────────────────────────────────── */ pub fn update_file_path(conn: &Connection, old_path: &str, new_path: &str) -> Result<()> { let old_path = to_db_path(old_path); @@ -437,7 +437,7 @@ pub fn rename_directory(conn: &mut Connection, old_dir: &str, new_dir: &str) -> Ok(()) } -/* ─── backup / restore helpers ────────────────────────────────────── */ +/* ─── backup / restore helpers ───────────────────────────────────── */ pub fn backup>(db_path: P) -> Result { let src = db_path.as_ref(); @@ -463,7 +463,7 @@ pub fn restore>(backup_path: P, live_db_path: P) -> Result<()> { Ok(()) } -/* ─── tests ───────────────────────────────────────────────────────── */ +/* ─── tests ─────────────────────────────────────────────────────── */ #[cfg(test)] mod tests { diff --git a/libmarlin/src/db_tests.rs b/libmarlin/src/db_tests.rs index f84d6bc..f907e10 100644 --- a/libmarlin/src/db_tests.rs +++ b/libmarlin/src/db_tests.rs @@ -194,7 +194,7 @@ fn backup_and_restore_cycle() { // backup let backup = db::backup(&db_path).unwrap(); drop(live); // close connection on Windows - // remove original + // remove original std::fs::remove_file(&db_path).unwrap(); // restore db::restore(&backup, &db_path).unwrap();