Skip to main content

snapshot

Function snapshot 

Source
pub async fn snapshot(
    conn: &mut PgConnection,
    blobs: &PgBlobStore,
    through: Seq,
    created_at: &Timestamp,
) -> Result<Checkpoint, Refusal>
Expand description

Snapshot the projections as conn’s transaction will leave them, store the records, and record the checkpoint.

The blob is committed through the blob store’s OWN connections, so it lands before the caller’s transaction does. If that transaction then rolls back, what is left is a blob nothing references — which is precisely what sweep reclaims, and why sweep has to consider checkpoints as well as events.

The reverse order is what has no recovery: a checkpoint row committed beside a blob whose write was rolled back is a checkpoint that fails validation forever, and the fallback ladder would walk past it on every single startup.