Layout
.hibi/ except what its own .gitignore excludes.
Nothing outside .hibi/ is written by hibi, apart from the
cache in your user cache directory.
Shards and lines
A claim lives inclaims/<s>.jsonl, where <s> is the first hex digit of the
BLAKE3 hash of its subject’s locator. Its marks and retirements live in
marks/<s>.jsonl, the shard of their claim. All claims about one document
are therefore in one shard.
Each line is one record as canonical JSON (RFC 8785: sorted keys, no extra
whitespace), and each shard is sorted by id. A claim line and a retirement
line from the walkthrough:
output
hibi schema claim, hibi schema mark and hibi schema retirement print
the record schemas.
Merging branches
.hibi/.gitattributes, as init writes it, marks the shards for git’s union
merge:
merge=union has not been verified.
If a pull request shows a conflict in a shard, merge locally with git.
Writes
Every write takes an exclusive lock on.hibi/.lock (waiting up to 10
seconds, then failing with store_locked), re-reads each shard it changes,
writes a temporary file, syncs it to disk and renames it over the shard.
Claim shards are written before mark shards, so a crash can leave at worst a
claim without its mark, which reads as stale.
A write that would make a shard larger than 64 MiB, or all shards together
larger than 256 MiB, is refused with store_full before anything is
written. Retired claims stay in the store by design, so a store does not
shrink.
Damage and refusals
The remediation for
store_corrupt says to look at the named file first,
with git diff -- <file>. Restoring it with git checkout -- <file> also
discards every record in it that is not committed yet, so keep those lines
if there are any. For a missing directory it says to look with
git status -- <dir>: restoring the directory from git brings back the
committed records only.
Stores from hibi 0.x
hibi 0.x kept its store in.claims/. This version does not read, convert or
delete it, and refuses to run in a repository that has one:
output
version, schema and completions run in such a repository.
Finding the root
The root is the directory given by--root, or else the nearest directory,
upward from the working directory, that contains .hibi/hibi.toml. None is
the error not_initialized. init creates the store at the top level of the
git repository.
