Add local batched Git blob reader
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Computational Efficiency Implementation Plan
|
||||
|
||||
**Status:** Stages 1–3 complete; Stages 4–11 pending.
|
||||
**Status:** Stages 1–4 complete; Stages 5–11 pending.
|
||||
|
||||
## Purpose And Baseline
|
||||
|
||||
@@ -236,6 +236,24 @@ by deterministic cleanup. Update the process inventory description when needed.
|
||||
**Owners:** A focused reader file and tests under `internal/git`, reusing
|
||||
[source.go](../../internal/git/source.go).
|
||||
|
||||
**Completion:** Complete. `BlobReader` lazily starts one local-only
|
||||
`git cat-file --batch` process, serializes request/response exchanges, and
|
||||
returns caller-owned body bytes after validating the object ID, blob type,
|
||||
representable size, and framing. Missing objects produce contextual errors
|
||||
without invalidating a healthy session. Broken exchanges and cancellation close
|
||||
the pipes and reap the child, preserving the original failure, Git stderr, and
|
||||
process causes. Existing standalone blob and committed-file readers remain in
|
||||
place. Tests cover repeated loose and packed reads, empty and binary bodies,
|
||||
missing objects, partial clones, malformed/truncated responses, cancellation,
|
||||
and child failures.
|
||||
|
||||
The process-reuse benchmark used one 9-byte blob. A new reader per read took
|
||||
1.98–2.24 ms and allocated 37.9 KB in 190 allocations per operation; a shared
|
||||
session took 57–82 μs and allocated 425 B in 8 allocations. The fresh-session
|
||||
measurement includes process startup and clean close per read. The shared-session
|
||||
timer includes lazy startup on its first read; final cleanup is outside the
|
||||
timer. This is a fixture-specific measurement, not a subprocess-count contract.
|
||||
|
||||
1. Add an internal `BlobReader` that stores a repository directory and parent
|
||||
context. Create its process lazily on the first content request through
|
||||
`process.StartPiped` with `git cat-file --batch`.
|
||||
|
||||
Reference in New Issue
Block a user