aboutsummaryrefslogtreecommitdiff
path: root/format/pack/ingest/state.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-08 12:03:26 +0800
committerGravatar Runxi Yu2026-03-08 12:03:26 +0800
commitae5c818674e2c9ca950ca7a9bf93f1283e7411b7 (patch)
tree25d1702260993a8066690c93b3da81adea6d4258 /format/pack/ingest/state.go
parentreceivepack: Trivial caps (diff)
signatureNo signature
receivepack, format/pack/ingest: Two-stage ingestion
Diffstat (limited to 'format/pack/ingest/state.go')
-rw-r--r--format/pack/ingest/state.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/format/pack/ingest/state.go b/format/pack/ingest/state.go
index cbc412e3..d44b6e09 100644
--- a/format/pack/ingest/state.go
+++ b/format/pack/ingest/state.go
@@ -18,6 +18,8 @@ type ingestState struct {
algo objectid.Algorithm
opts Options
+ packHeaderRaw [packHeaderSize]byte
+
packFile *os.File
packTmpName string
idxFile *os.File
@@ -47,18 +49,22 @@ func newIngestState(
destination *os.Root,
algo objectid.Algorithm,
opts Options,
+ header HeaderInfo,
+ headerRaw [packHeaderSize]byte,
) (*ingestState, error) {
if algo.Size() == 0 {
return nil, objectid.ErrInvalidAlgorithm
}
return &ingestState{
- src: src,
- destination: destination,
- algo: algo,
- opts: opts,
- offsetToRecord: make(map[uint64]int),
- objectToRecord: make(map[objectid.ObjectID]int),
- baseCache: newDeltaBaseCache(defaultDeltaBaseCacheMaxBytes),
+ src: src,
+ destination: destination,
+ algo: algo,
+ opts: opts,
+ packHeaderRaw: headerRaw,
+ objectCountHeader: header.ObjectCount,
+ offsetToRecord: make(map[uint64]int),
+ objectToRecord: make(map[objectid.ObjectID]int),
+ baseCache: newDeltaBaseCache(defaultDeltaBaseCacheMaxBytes),
}, nil
}