aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-14 00:00:00 +0000
committerGravatar Runxi Yu2025-11-14 00:00:00 +0000
commit0587025b7d48bae29b0843c2c4ab691b99f82752 (patch)
tree231f521434a6791d37e4ce437925c0d077d2c9fa
parentREADME: Note about goals on synchronization (diff)
signature
Unexport PackLocation
-rw-r--r--pack_idx.go10
-rw-r--r--pack_pack.go18
2 files changed, 14 insertions, 14 deletions
diff --git a/pack_idx.go b/pack_idx.go
index eec2f3b9..ede8c2e6 100644
--- a/pack_idx.go
+++ b/pack_idx.go
@@ -238,10 +238,10 @@ func (pi *packIndex) offset(idx int) (uint64, error) {
return readBE64(pi.offset64[base : base+8]), nil
}
-func (pi *packIndex) lookup(id Hash) (PackLocation, error) {
+func (pi *packIndex) lookup(id Hash) (packlocation, error) {
err := pi.ensureLoaded()
if err != nil {
- return PackLocation{}, err
+ return packlocation{}, err
}
first := int(id[0])
var lo int
@@ -251,13 +251,13 @@ func (pi *packIndex) lookup(id Hash) (PackLocation, error) {
hi := int(pi.fanoutEntry(first))
idx, found := bsearchHash(pi.names, HashSize, lo, hi, id)
if !found {
- return PackLocation{}, ErrNotFound
+ return packlocation{}, ErrNotFound
}
ofs, err := pi.offset(idx)
if err != nil {
- return PackLocation{}, err
+ return packlocation{}, err
}
- return PackLocation{
+ return packlocation{
PackPath: pi.packPath,
Offset: ofs,
}, nil
diff --git a/pack_pack.go b/pack_pack.go
index ee4d2b7a..285431d8 100644
--- a/pack_pack.go
+++ b/pack_pack.go
@@ -18,8 +18,8 @@ const (
packVersion2 = 2
)
-// PackLocation identifies the path to a pack file and an offset inside it.
-type PackLocation struct {
+// packlocation identifies the path to a pack file and an offset inside it.
+type packlocation struct {
PackPath string
Offset uint64
}
@@ -32,10 +32,10 @@ func (repo *Repository) packRead(id Hash) (Object, error) {
return repo.packReadAt(loc, id)
}
-func (repo *Repository) packIndexFind(id Hash) (PackLocation, error) {
+func (repo *Repository) packIndexFind(id Hash) (packlocation, error) {
idxs, err := repo.packIndexes()
if err != nil {
- return PackLocation{}, err
+ return packlocation{}, err
}
for _, idx := range idxs {
loc, err := idx.lookup(id)
@@ -43,14 +43,14 @@ func (repo *Repository) packIndexFind(id Hash) (PackLocation, error) {
continue
}
if err != nil {
- return PackLocation{}, err
+ return packlocation{}, err
}
return loc, nil
}
- return PackLocation{}, ErrNotFound
+ return packlocation{}, ErrNotFound
}
-func (repo *Repository) packReadAt(loc PackLocation, want Hash) (Object, error) {
+func (repo *Repository) packReadAt(loc packlocation, want Hash) (Object, error) {
ty, body, err := repo.packBodyResolveAtLocation(loc)
if err != nil {
return nil, err
@@ -65,7 +65,7 @@ func (repo *Repository) packReadAt(loc PackLocation, want Hash) (Object, error)
return obj, err
}
-func (repo *Repository) packBodyResolveAtLocation(loc PackLocation) (ObjType, borrowedBody, error) {
+func (repo *Repository) packBodyResolveAtLocation(loc packlocation) (ObjType, borrowedBody, error) {
pf, err := repo.packFile(loc.PackPath)
if err != nil {
return ObjInvalid, borrowedBody{}, err
@@ -73,7 +73,7 @@ func (repo *Repository) packBodyResolveAtLocation(loc PackLocation) (ObjType, bo
return repo.packBodyResolveWithin(pf, loc.Offset)
}
-func (repo *Repository) packTypeSizeAtLocation(loc PackLocation, seen map[packKey]struct{}) (ObjType, int64, error) {
+func (repo *Repository) packTypeSizeAtLocation(loc packlocation, seen map[packKey]struct{}) (ObjType, int64, error) {
pf, err := repo.packFile(loc.PackPath)
if err != nil {
return ObjInvalid, 0, err