aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-08-23 01:23:23 +0200
committerGitHub <noreply@github.com>2018-08-23 01:23:23 +0200
commit005d5dc961a7053d88da53536f4a5eb4c305529b (patch)
treed73393383d45b3769c1fb63903a6cf2b02b8d1aa /storage/filesystem
parentcdfa0bb8d987272b5729e565dbcc64f07963d77d (diff)
parent790191ef92ec6382ce65cc30286c901863b3b7a3 (diff)
downloadgo-git-005d5dc961a7053d88da53536f4a5eb4c305529b.tar.gz
Merge pull request #929 from jfontan/fix/reuse-base-cache
plumbing, storage: add bases to the common cache
Diffstat (limited to 'storage/filesystem')
-rw-r--r--storage/filesystem/object.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go
index 6958e32..3a3a2bd 100644
--- a/storage/filesystem/object.go
+++ b/storage/filesystem/object.go
@@ -295,7 +295,14 @@ func (s *ObjectStorage) decodeObjectAt(
return nil, err
}
- return packfile.NewPackfile(idx, s.dir.Fs(), f).GetByOffset(offset)
+ var p *packfile.Packfile
+ if s.deltaBaseCache != nil {
+ p = packfile.NewPackfileWithCache(idx, s.dir.Fs(), f, s.deltaBaseCache)
+ } else {
+ p = packfile.NewPackfile(idx, s.dir.Fs(), f)
+ }
+
+ return p.GetByOffset(offset)
}
func (s *ObjectStorage) decodeDeltaObjectAt(
@@ -486,7 +493,14 @@ func newPackfileIter(
index idxfile.Index,
cache cache.Object,
) (storer.EncodedObjectIter, error) {
- iter, err := packfile.NewPackfile(index, fs, f).GetByType(t)
+ var p *packfile.Packfile
+ if cache != nil {
+ p = packfile.NewPackfileWithCache(index, fs, f, cache)
+ } else {
+ p = packfile.NewPackfile(index, fs, f)
+ }
+
+ iter, err := p.GetByType(t)
if err != nil {
return nil, err
}