Skip to main content

rehydrate

Function rehydrate 

Source
pub async fn rehydrate(
    conn: &Connection,
    ids: &[&str],
    archive_path: &Path,
) -> Result<RehydrateReport>
Expand description

Move concepts back from the cold file into the hot tables (§2.3, C3).

§Rehydration is a move back, not a write

It mints no transaction-time facts and is invisible to both clocks. The concept’s log entries were never removed, so the ledger already says everything true about it; writing a fresh 'I' would assert the concept was learned at rehydration time, and — because the fold takes the highest seq_id per entity — would additionally outrank any later 'U' that retired it. See crate::schema::ddl::CREATE_CONCEPTS_LOG_INSERT, which is marker-gated at v10 for exactly this reason. The whole operation therefore runs inside a declared archive session, which is what suppresses the trigger.

§rowid_pk: reinstate, or reassign and re-point the index

The common case has no collision — the rowid was freed by archival and nothing has claimed it since — and reinstating is the clean move-back with no side effects at all. When something has taken it, the fallback is a fresh rowid_pk plus an FTS correction: concepts_fts is external-content keyed on rowid_pk ([D-119]), so a reassignment without re-pointing leaves the index describing the wrong row, silently. Both exits are taken here rather than one being assumed, and RehydrateReport::rowids_reassigned reports which was used.