From a98a111780a74fbc1418d8fc8acc852b9d6187d2 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Fri, 9 Sep 2016 22:51:39 +0200 Subject: storage: filesystem iter implementation --- core/storage.go | 19 ++++++++++++------- 1 file 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) -- cgit