diff options
| author | 2026-03-03 18:26:57 +0800 | |
|---|---|---|
| committer | 2026-03-03 18:31:11 +0800 | |
| commit | bd9519b464f919f2ca174a45c3c19c9a8a1fe3d1 (patch) | |
| tree | 1bc180ed1a1bdffc13569f552f70bc8b252fbed7 /objectstore/packed/store.go | |
| parent | config: Add fuzz, regression tests, and updates (diff) | |
| signature | No signature | |
objectstore/packed: Check pack/idx checksums here.
We previously had helpers in format/pack/checksum that checks
.pack/.idx-related checksums with []byte-based APIs. But it only really
makes sense to use those []byte-based APIs on mmap's (otherwise it'd be
horribly inefficient).
Since the packed object-store only needs to check that the .pack and
.idx trailer match, we move the relevant part into objectstore/packed.
The rest are deleted for now; we'll definitely need a streaming version
for the pack verification (when ingesting packfiles from the network)
(though we might just make it a streaming API (writer? reader? not
decided yet) that *produces* a hash, then verify it in the caller; this
way we could reuse the function in the pack-producing routines). The
others might get the []byte-based APIs back, or perhaps they too get
streaming APIs.
Remember that "reading objects from a packed object store",
"creating/writing packfiles", and "ingesting an incoming pack (which
usually involves creating an .idx for it)", are all very different
tasks.
Diffstat (limited to 'objectstore/packed/store.go')
| -rw-r--r-- | objectstore/packed/store.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/objectstore/packed/store.go b/objectstore/packed/store.go index bb6936ea..abd7175f 100644 --- a/objectstore/packed/store.go +++ b/objectstore/packed/store.go @@ -7,7 +7,6 @@ import ( "os" "sync" - packchecksum "codeberg.org/lindenii/furgit/format/pack/checksum" "codeberg.org/lindenii/furgit/objectid" "codeberg.org/lindenii/furgit/objectstore" ) @@ -195,7 +194,7 @@ func (store *Store) verifyPackMatchesIndexes(pack *packFile) error { if err != nil { return err } - if err := packchecksum.VerifyPackMatchesIdx(pack.data, index.data, store.algo); err != nil { + if err := verifyMappedPackMatchesMappedIdx(pack.data, index.data, store.algo); err != nil { return fmt.Errorf("objectstore/packed: pack %q does not match idx %q: %w", pack.name, index.idxName, err) } return nil |
