aboutsummaryrefslogtreecommitdiff
path: root/objectstore/packed/idx_open.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-06 11:26:21 +0800
committerGravatar Runxi Yu2026-03-06 11:30:56 +0800
commit75c7147c6afcb64a7c8bfedb08f1613c5011ff71 (patch)
treed348e7f4eeec5a905970a7ff14c5c2dd492d944a /objectstore/packed/idx_open.go
parentformat/commitgraph: Split files (diff)
signatureNo signature
objectstore/packed: Split files
Diffstat (limited to 'objectstore/packed/idx_open.go')
-rw-r--r--objectstore/packed/idx_open.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/objectstore/packed/idx_open.go b/objectstore/packed/idx_open.go
index c3c97e4d..9eb92682 100644
--- a/objectstore/packed/idx_open.go
+++ b/objectstore/packed/idx_open.go
@@ -9,44 +9,6 @@ import (
"codeberg.org/lindenii/furgit/objectid"
)
-// idxFile stores one mapped and validated idx v2 file.
-type idxFile struct {
- // idxName is the basename of this .idx file.
- idxName string
- // packName is the matching .pack basename.
- packName string
- // algo is the hash algorithm encoded by the index.
- algo objectid.Algorithm
-
- // file is the opened index file descriptor.
- file *os.File
- // data is the mapped index bytes.
- data []byte
-
- // fanout stores fanout table values.
- fanout [256]uint32
- // numObjects equals fanout[255].
- numObjects int
-
- // namesOffset starts the sorted object-id table.
- namesOffset int
- // offset32Offset starts the 32-bit offset table.
- offset32Offset int
- // offset64Offset starts the 64-bit offset table.
- offset64Offset int
- // offset64Count is the number of 64-bit offset entries.
- offset64Count int
-}
-
-// candidateForPack returns one discovered candidate for a pack basename.
-func (store *Store) candidateForPack(packName string) (packCandidate, bool) {
- store.candidatesMu.RLock()
- candidate, ok := store.candidateByPack[packName]
- store.candidatesMu.RUnlock()
-
- return candidate, ok
-}
-
// openIndex returns one opened and parsed index, caching it by pack basename.
func (store *Store) openIndex(candidate packCandidate) (*idxFile, error) {
store.idxMu.RLock()
@@ -134,28 +96,3 @@ func openIdxFile(root *os.Root, idxName, packName string, algo objectid.Algorith
return index, nil
}
-
-// close unmaps and closes one idx handle.
-func (index *idxFile) close() error {
- var closeErr error
-
- if index.data != nil {
- err := syscall.Munmap(index.data)
- if err != nil && closeErr == nil {
- closeErr = err
- }
-
- index.data = nil
- }
-
- if index.file != nil {
- err := index.file.Close()
- if err != nil && closeErr == nil {
- closeErr = err
- }
-
- index.file = nil
- }
-
- return closeErr
-}