Repository navigation
Description
Deferred from #185, which is now complete across all three stages (#509 format, #513 write,
#516 read). Filing it so the decision does not survive only as a paragraph in a closed issue.
What exists today
A framed object carries ObjectFS's own frame index in a leading skippable frame: frame size,
total size, per-frame compressed and uncompressed lengths, a SHA-256 per frame and one over
the whole content. Every conformant zstd decoder ignores a skippable frame, so zstd -d and
aws s3 cp already return these objects byte for byte. What they cannot do is seek —
the index is ObjectFS's format, read only by ObjectFS.
What is missing
The Zstandard Seekable Format
defines a standard seek table in a skippable frame with magic 0x184D2A5E (the 0xE
variant), holding per-frame compressed/decompressed sizes and an optional checksum, with a
footer at the very end of the object. A reader that understands it can seek any object
carrying it, without knowing anything about ObjectFS.
Emitting one in addition to our own index would mean zstd's own seekable tooling, and
anything else built on that spec, could do ranged reads of an ObjectFS-written object
directly.
Why it was not done in #185
Not because it is hard, but because it is additive to a format that now works end to end.
Framing changes the stored bytes of every compressible object a mount writes; that change had
to be proven correct through the unchanged reader before anything was built on top of it, and
adding a second index format in the same milestone would have meant two new things to be wrong
at once, in the one place where being wrong is expensive.
Nothing about the current format precludes it. The seek table is another skippable frame, so
it composes with the existing one.
Design questions to settle first
- Two indexes or one? Ours carries per-frame SHA-256, which the standard table does not
(it has an optional 32-bit xxhash). Since integrity is this project's first priority, our
index cannot simply be replaced by the standard one — so the likely answer is both, and the
cost is a second index's worth of bytes on every framed object. Worth measuring before
committing. - The footer at the end conflicts with a single-request index fetch. The standard puts its
footer at the end of the object; ourobjectfs-seekablemetadata key exists precisely so a
reader can find our index in one correctly-sized request. A standard-format reader needing a
tail read is its problem, not ours — but confirm this does not push us into writing our own
frame index at the end too, which would cost our read path a request. - Is there a consumer? This is interop for its own sake until someone names a tool they
want to point at a bucket. A plausible real answer is lith (github.com/scttfrdmn/lith), the
read-only half of the same problem, which could seek these objects without depending on
objectfs. That would be a consumer rather than a hypothetical.
Recommendation: do not build this until (3) has an answer. The bytes are spent on every
compressible object written, and an unused index is pure overhead on the exact axis framing
was introduced to improve.
Activity