aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/storer
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-08-30 20:28:40 +0200
committerJavi Fontan <jfontan@gmail.com>2018-09-04 12:41:31 +0200
commit6384ab93a2dbac9045ee19099455cbcfe82d0201 (patch)
tree66be7ef79ec1267306af9e5e4b9870dde54ef5db /plumbing/storer
parent2f1583896bcc3c182d8165d6aeeb23c771cc5417 (diff)
downloadgo-git-6384ab93a2dbac9045ee19099455cbcfe82d0201.tar.gz
storage/dotgit: add KeepDescriptors option
This option maintains packfile file descriptors opened after reading objects from them. It improves performance as it does not have to be opening packfiles each time an object is needed. Also adds Close to EncodedObjectStorer to close all the files manualy. Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'plumbing/storer')
-rw-r--r--plumbing/storer/object.go2
-rw-r--r--plumbing/storer/object_test.go4
2 files changed, 6 insertions, 0 deletions
diff --git a/plumbing/storer/object.go b/plumbing/storer/object.go
index 92aa629..806b6bb 100644
--- a/plumbing/storer/object.go
+++ b/plumbing/storer/object.go
@@ -40,6 +40,8 @@ type EncodedObjectStorer interface {
// HasEncodedObject returns ErrObjNotFound if the object doesn't
// exist. If the object does exist, it returns nil.
HasEncodedObject(plumbing.Hash) error
+ // Close any opened files.
+ Close() error
}
// DeltaObjectStorer is an EncodedObjectStorer that can return delta
diff --git a/plumbing/storer/object_test.go b/plumbing/storer/object_test.go
index 6b4fe0f..adddec4 100644
--- a/plumbing/storer/object_test.go
+++ b/plumbing/storer/object_test.go
@@ -157,3 +157,7 @@ func (o *MockObjectStorage) IterEncodedObjects(t plumbing.ObjectType) (EncodedOb
func (o *MockObjectStorage) Begin() Transaction {
return nil
}
+
+func (o *MockObjectStorage) Close() error {
+ return nil
+}