MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / append_envelopes

Function append_envelopes

libatomic/src/daemon/provenance_core.rs:123–136  ·  view source on GitHub ↗

Append one durable envelope batch with generation fencing. Duplicate event IDs re-acknowledge their original sequences; a committed batch returns only after the transaction commits.

(
    store: &RedbChangeStore,
    id: ProvenanceId,
    expected_generation: u64,
    batch: &[(&str, &[u8])],
    now: i64,
)

Source from the content-addressed store, hash-verified

121/// event IDs re-acknowledge their original sequences; a committed batch
122/// returns only after the transaction commits.
123pub fn append_envelopes(
124 store: &RedbChangeStore,
125 id: ProvenanceId,
126 expected_generation: u64,
127 batch: &[(&str, &[u8])],
128 now: i64,
129) -> Result<Vec<StoredProvenanceEnvelope>, JournalError> {
130 owner_failpoint("before-envelope-commit");
131 let stored = store
132 .append_provenance_envelopes(id, expected_generation, batch, now)
133 .map_err(|error| JournalError::store(ErrorCode::ProvenanceStore, error))?;
134 owner_failpoint("after-envelope-commit");
135 Ok(stored)
136}
137
138/// Freeze the journal frontier and persist one recoverable checkpoint
139/// attempt, with the legacy `reuse_frozen_changes` recovery: a previous

Callers 1

append_envelopes_implFunction · 0.85

Calls 3

owner_failpointFunction · 0.85
storeFunction · 0.85

Tested by

no test coverage detected