diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-02-25 10:18:48 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-02-25 10:18:48 +0100 |
commit | 5bc563727ffa798caee3b007c366eb66c3d69caa (patch) | |
tree | 6107f49405bb605793f1bcd7ef4961ceadcb11e9 /core/object.go | |
parent | 07ca1ac7f3058ea6d3274a01973541fb84782f5e (diff) | |
parent | 0d999e1db6cd8736ab697de8ce848fa3a5274b9f (diff) | |
download | go-git-5bc563727ffa798caee3b007c366eb66c3d69caa.tar.gz |
Merge pull request #34 from scjalliance/object-reader-writer
Refactor to use core.ObjectReader and core.ObjectWriter
Diffstat (limited to 'core/object.go')
-rw-r--r-- | core/object.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/core/object.go b/core/object.go index 74ea555..d56a44a 100644 --- a/core/object.go +++ b/core/object.go @@ -10,6 +10,21 @@ var ( ObjectNotFoundErr = errors.New("object not found") ) +// TODO: Consider adding a Hash function to the ObjectReader and ObjectWriter +// interfaces that returns the hash calculated for the reader or writer. + +// ObjectReader is a generic representation of an object reader. +// +// ObjectReader implements io.ReadCloser. Close should be called when finished +// with it. +type ObjectReader io.ReadCloser + +// ObjectWriter is a generic representation of an object writer. +// +// ObjectWriter implements io.WriterCloser. Close should be called when finished +// with it. +type ObjectWriter io.WriteCloser + // Object is a generic representation of any git object type Object interface { Hash() Hash @@ -17,8 +32,8 @@ type Object interface { SetType(ObjectType) Size() int64 SetSize(int64) - Reader() io.Reader - Writer() io.Writer + Reader() (ObjectReader, error) + Writer() (ObjectWriter, error) } // ObjectStorage generic storage of objects |