Expand description
The long-lived object reader that answers every blob read of an invocation.
What:
One long-lived git cat-file --batch process that answers every object read of an invocation.
Why:
Starting Git costs far more than reading one object,
so candidate bytes are read
through a single process whose count does not grow with the number of files.
Blob bytes are remembered by object name:
a name always denotes the same bytes,
so a remembered blob can never become stale.
In TS you’d write (pseudocode):
// const reader = startObjectReader(git); const bytes = await reader.blob(oid);Structs§
- Object
Reader - What:
A running object reader and the blobs it has already read.
Option<ReaderPipes>is “open pipes or nothing”; nothing means closed.Rc<[u8]>is a shared read-only byte list. Why: One value owns the process for its whole life, so the process is always stopped and collected when the value is dropped.
Constants§
- OBJECT_
MISSING_ PREFIX - What:
The start of the message for a candidate object that Git does not have; the object name follows.
Why:
A commit the service takes reads its content back through the policies, and an object removed meanwhile (a pruning
git gc) fails there. The commit path recognizes that message by this start, so the producer and the reader of the text cannot drift apart.
Functions§
- start_
object_ reader - What:
Start the reader for the repository the caller’s global options select.
&[OsString]borrows the arguments before the subcommand, unchanged;&[(OsString, OsString)]borrows added environment pairs.Result<T, E>is “a value or a failure”. Why: Replaying the global prefix makes the reader open the same repository as the forwarded command. The overlay may point it at a private object directory, so one reader is bound to one overlay for its whole life. - start_
object_ reader_ with - What:
start_object_readerwith the notice cadence, the bound and the notice sink of its requests chosen by the caller. Why: The production entry reads them from the environment; tests choose short ones and read the notices from a buffer.