aboutsummaryrefslogtreecommitdiffstats
path: root/storage/seekable/storage.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-11 18:07:29 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-11 18:07:29 +0200
commit1f64d789038594098ea2c9cf796391f101d0bea5 (patch)
tree50fb530fc2e48560e70489dc81758f54822dcf50 /storage/seekable/storage.go
parentc1e277a7ca75ff84741d75ad45e29a2ff3e633e3 (diff)
downloadgo-git-1f64d789038594098ea2c9cf796391f101d0bea5.tar.gz
core: new MemoryObject, move from memory.Object, packfile.Parser, base on new ObjectStorage interface
Diffstat (limited to 'storage/seekable/storage.go')
-rw-r--r--storage/seekable/storage.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/storage/seekable/storage.go b/storage/seekable/storage.go
index 9cc37ba..e056c54 100644
--- a/storage/seekable/storage.go
+++ b/storage/seekable/storage.go
@@ -90,6 +90,10 @@ func buildIndexFromIdxfile(fs fs.FS, path string) (index.Index, error) {
return index.NewFromIdx(f)
}
+func (s *ObjectStorage) NewObject() core.Object {
+ return &core.MemoryObject{}
+}
+
// Set adds a new object to the storage. As this functionality is not
// yet supported, this method always returns a "not implemented yet"
// error an zero hash.
@@ -131,7 +135,8 @@ func (s *ObjectStorage) Get(h core.Hash) (core.Object, error) {
r.HashToOffset = map[core.Hash]int64(s.index)
p := packfile.NewParser(r)
- return p.ReadObject()
+ obj := s.NewObject()
+ return obj, p.FillObject(obj)
}
// Iter returns an iterator for all the objects in the packfile with the