From ae5c818674e2c9ca950ca7a9bf93f1283e7411b7 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 8 Mar 2026 12:03:26 +0800 Subject: receivepack, format/pack/ingest: Two-stage ingestion --- format/pack/ingest/state.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'format/pack/ingest/state.go') 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 } -- cgit v1.3.1-10-gc9f91