Expand description
Graph-level storage integration (M4.E2 — D170–D174).
Free functions (not Graph methods) because graphrefly-graph does not
depend on graphrefly-storage — the dependency flows in the other
direction. See D170.
§Provided APIs
GraphCheckpointRecord— portable baseline type wrapping aGraphPersistSnapshot+ seq metadata +format_version(F7 close).diff_snapshots/decompose_diff_to_frames— snapshot diff → WAL frame generation engine (D172).attach_snapshot_storage+StorageHandle— wire observe subscription → snapshot diff → WAL frame writes.restore_snapshot— three-phase replay (baseline → checksum verify → lifecycle-scoped batch).
§Manifest (D173 — F4 close)
F4 (cross-restart key recovery) is structurally closed by D174: at the
attach boundary, key_of is derived deterministically from
graph.name. On restore, the snapshot key is known without a separate
manifest entry. The checkpoint record’s seq field serves as the WAL
high-water mark.
Structs§
- Attach
Options - Options for
attach_snapshot_storage. - Attach
Tier Pair - Configuration for a single snapshot+WAL tier pair.
- Graph
Checkpoint Record - Portable baseline record written by
attach_snapshot_storageon full-snapshot writes. Contains the fullGraphPersistSnapshotplus metadata for WAL cursor alignment. - Graph
Snapshot Diff - Structural diff between two
GraphPersistSnapshots. - Restore
Options - Options for
restore_snapshot. - Storage
Handle - Handle returned by
attach_snapshot_storage. - Value
Change - A single node value change detected by
diff_snapshots.
Enums§
- Torn
Write Policy - Torn-write policy for mid-stream checksum failures.
Constants§
- SNAPSHOT_
VERSION - Current snapshot format version. Embedded in
GraphCheckpointRecordand inBaseChange.versionwithin decomposed WAL frames (F7 close).
Functions§
- attach_
snapshot_ storage - Wire an observe subscription on
graphthat persists node changes to the provided snapshot+WAL tier pairs. - decompose_
diff_ to_ frames - Convert a
GraphSnapshotDiffinto WAL frames ready for persistence. - diff_
snapshots - Compare two snapshots and produce a structural diff.
- restore_
snapshot - Three-phase WAL replay: baseline load → checksum verify → lifecycle- scoped batch.
Type Aliases§
- Error
Callback - Error callback for
AttachOptions. - OnTorn
Write - Callback for torn-write decisions. Receives the
frame_seqand reason; returns the desired policy. - Path
Filter - Filter predicate for
AttachOptions.