Repository navigation
Draft on-disk format 1: framed segment log and capsule journal - #127
Merged
Merged
Conversation
Add docs/on-disk-format.md, a draft spec (not implemented) for making every durable fact rebuildable from append-only files: - A 48-byte checksummed frame on every record. - SEGMENT records that carry their write-once descriptor next to the stored bytes, replacing the JSON sidecar. - A separate capsule journal (CAPSULE manifests with a logical digest, DROP, NAMESPACE, BIND, UNBIND, atomic BATCH), with sled demoted to a rebuildable index and ref counts derived from live manifests. - Torn-tail truncation, read-only open on mid-file corruption, and compaction by generation swap. Targets #96, #97 and #108. Link it from docs/README.md as a draft.
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds docs/on-disk-format.md, a draft spec for store format 1, and links it from
docs/README.mdas a draft. Nothing is implemented. This PR exists to agree the format before code lands.Refs #96, #97, #108. Doesn't close any of them.
Why. Each of those three issues needs a change to the log, and #96's own suggested fix is a header on every record. Fixing them one at a time would change the on-disk format two or three times. This spec does it once, and makes the capsule the durable unit: everything else can be rebuilt from it.
What the spec defines:
SEGMENTrecords hold the write-once metadata next to the stored bytes, replacing the JSON sidecar that's rewritten on every append and every ref-count change.space.journalis a separate file holdingCAPSULEmanifests (segment entries with content hashes, plus a BLAKE3 digest of the logical bytes),DROP,NAMESPACE,BIND,UNBINDand atomicBATCH.serve-s3onSPACE_STORAGE_ROOThas no log, and because rebuilding the index then reads only manifests.space.dbcosts one replay, and sled stops flushing on every update.BATCH, so a crash can't orphan a capsule. A dedup hit writes nothing until its capsule commits, which fixes the ref-count drift in Interrupted writes leave orphaned segments that nothing ever reclaims #97.doctorreports it.What a reviewer should know:
Type
Checklist
Quality gates
Not applicable: docs only, no crate changes.
typosis clean on both files.cargo fmt --allcargo clippy --all-targets -- -D warningscargo test --workspace)cargo xtask audit(if touching crates, deps, or features)RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-depsDocumentation
Security
unsafeblocks (or they are justified and documented)