Expand description
Change lifecycle tracking and durable write-ahead log.
When a storage mutation spans both the high-volume (HV) and long-term (LT) backends, several non-atomic steps must happen in sequence: uploading to LT, committing a tombstone in HV via compare-and-swap, and cleaning up unreferenced blobs. A crash at any point can leave orphaned LT blobs.
This module provides two layers of protection:
-
In-process tracking —
ChangeGuardis an RAII guard that tracks the currentChangePhaseof an operation. When dropped, it spawns a background task to clean up whichever blob is unreferenced based on the phase reached before the drop. This handles normal errors and early returns within a running process. -
Durable write-ahead log — The
ChangeLogtrait records aChangeto durable storage before any LT side effects begin. If the process crashes, a recovery scan reads outstanding entries and cleans up orphaned blobs. Recovery is garbage collection — it never replays CAS mutations or finishes incomplete operations.
Structs§
- Change
- Describes the LT blobs involved in a multi-step storage change.
- Change
Guard - RAII guard that tracks cleanup state for a multi-step storage change.
- Change
Id - Unique identifier for a change log entry.
- Change
Manager - Manager for multi-step storage changes, including backends and durable log.
- InMemory
Change Log - In-memory
ChangeLogfor tests and deployments without durable logging. - Noop
Change Log ChangeLogimplementation that discards all entries.
Enums§
- Change
Phase - Phase of a multi-step storage change.
Traits§
- Change
Log - Durable write-ahead log for multi-step storage changes.