aboutsummaryrefslogtreecommitdiffstats
path: root/core/storage.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-09 22:51:39 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-09 22:51:39 +0200
commita98a111780a74fbc1418d8fc8acc852b9d6187d2 (patch)
tree0f53c445befadb01b73092adab604b3ce6f3efe7 /core/storage.go
parent6fe1b93e96d4384f34f0562f81116ae565c6954d (diff)
downloadgo-git-a98a111780a74fbc1418d8fc8acc852b9d6187d2.tar.gz
storage: filesystem iter implementation
Diffstat (limited to 'core/storage.go')
-rw-r--r--core/storage.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/core/storage.go b/core/storage.go
index add56d1..739dfb6 100644
--- a/core/storage.go
+++ b/core/storage.go
@@ -16,13 +16,6 @@ type ObjectStorage interface {
// NewObject returns a new Object, the real type of the object can be a
// custom implementation or the defaul one, MemoryObject
NewObject() Object
- // Writer retuns a writer for writing a packfile to the Storage, this method
- // is optional, if not implemented the ObjectStorage should return a
- // ErrNotImplemented error.
- //
- // If the implementation not implements Writer the objects should be written
- // using the Set method.
- Writer() (io.WriteCloser, error)
// Set save an object into the storage, the object shuld be create with
// the NewObject, method, and file if the type is not supported.
Set(Object) (Hash, error)
@@ -43,6 +36,18 @@ type ObjectStorage interface {
Begin() TxObjectStorage
}
+// ObjectStorageWrite is a optional method for ObjectStorage, it enable direct
+// write of packfile to the storage
+type ObjectStorageWrite interface {
+ // Writer retuns a writer for writing a packfile to the Storage, this method
+ // is optional, if not implemented the ObjectStorage should return a
+ // ErrNotImplemented error.
+ //
+ // If the implementation not implements Writer the objects should be written
+ // using the Set method.
+ Writer() (io.WriteCloser, error)
+}
+
// ObjectIter is a generic closable interface for iterating over objects.
type ObjectIter interface {
Next() (Object, error)