Skip to main content

Module refs

Module refs 

Source
Expand description

__gunnar_refs__ — the ref namespace as an append-only Arrow push log.

One RecordBatch per push, written through crate::pushlog. A push that updates three branches is three rows in one batch, and those three either all land or none do, because the frame either completes or it does not. That is the whole transaction mechanism — there is no lock file, no journal and (D18) no database.

§Columns

columnmeaning
namefull ref name, e.g. refs/heads/main
targetthe oid it now points at; null means the ref was deleted
peeledfor an annotated tag, the commit it peels to
symref_targetfor a symbolic ref (HEADrefs/heads/main), its target
push_seqmonotonic push counter — the ordering authority
updated_mswall clock, unix ms; for humans, never for ordering

updated_ms is deliberately not the ordering key: two pushes inside the same millisecond, or a clock that steps backwards, would silently reorder the ref namespace. push_seq is assigned by the writer and is the only thing fold compares.

§Current state

The log is the history; fold replays it into the current namespace, last writer wins by push_seq, and a null target removes the ref. Reading the current refs is therefore a scan of a structure sized by pushes, not by repository size.

Structs§

RefLog
The ref log of one repository.
RefState
The state of one ref after replaying the log.
RefUpdate
One ref update inside a push. Owned by the git-storage-trait contract; re-exported here so crate::refs::RefUpdate stays a valid path. One ref update in a push.

Functions§

build_push_batch
Build the single RecordBatch that is one push.
fold
Replay pushes into the current namespace. Last writer wins by push_seq; a null target and no symref_target deletes the ref.
read_refs
Read the sealed __gunnar_refs__ section out of an archive. Ok(None) when the archive carries none — distinct from an archive whose refs are empty.
refs_schema