Skip to main content

assert_db_anchor_consistent

Function assert_db_anchor_consistent 

Source
pub fn assert_db_anchor_consistent(
    resolved_db_path: Option<&Path>,
    args_db: Option<&str>,
) -> Result<()>
Expand description

Assert that a resolved db_path: which compute_config_id folds into a process’s config_id: agrees with what resolve_db_anchor derives from the same --db/KHIVE_DB input. Call this right after db_path is resolved at each construction boundary.

Guards against a construction path recomputing db_path independently of resolve_db_anchor: left unchecked, that would silently desync config_id from a daemon or peer sharing the same database instead of failing loud. Inert (Ok(())) when the anchor itself is None (the :memory: sentinel) since there is nothing to compare against.