diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-08 11:45:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 11:45:07 +0100 |
commit | b65d94e70ea1d013f43234522fa092168e4f1041 (patch) | |
tree | b36da73bd512d1b0ac52e4174ed8b7ed22c75b25 /plumbing/object/blob.go | |
parent | 431af32445562b389397f3ee7af90bf61455fff1 (diff) | |
parent | 84b6bd8c22c8683479881a67db03dfdeeeb299ce (diff) | |
download | go-git-b65d94e70ea1d013f43234522fa092168e4f1041.tar.gz |
Merge pull request #259 from smola/docs
Improve documentation
Diffstat (limited to 'plumbing/object/blob.go')
-rw-r--r-- | plumbing/object/blob.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/plumbing/object/blob.go b/plumbing/object/blob.go index f274e70..4c9e84d 100644 --- a/plumbing/object/blob.go +++ b/plumbing/object/blob.go @@ -8,9 +8,11 @@ import ( "srcd.works/go-git.v4/utils/ioutil" ) -// Blob is used to store file data - it is generally a file. +// Blob is used to store arbitrary data - it is generally a file. type Blob struct { + // Hash of the blob. Hash plumbing.Hash + // Size of the (uncompressed) blob. Size int64 obj plumbing.EncodedObject @@ -26,6 +28,7 @@ func GetBlob(s storer.EncodedObjectStorer, h plumbing.Hash) (*Blob, error) { return DecodeBlob(o) } +// DecodeObject decodes an encoded object into a *Blob. func DecodeBlob(o plumbing.EncodedObject) (*Blob, error) { b := &Blob{} if err := b.Decode(o); err != nil { @@ -91,16 +94,17 @@ type BlobIter struct { s storer.EncodedObjectStorer } -// NewBlobIter returns a BlobIter for the given repository and underlying -// object iterator. +// NewBlobIter takes a storer.EncodedObjectStorer and a +// storer.EncodedObjectIter and returns a *BlobIter that iterates over all +// blobs contained in the storer.EncodedObjectIter. // -// The returned BlobIter will automatically skip over non-blob objects. +// Any non-blob object returned by the storer.EncodedObjectIter is skipped. func NewBlobIter(s storer.EncodedObjectStorer, iter storer.EncodedObjectIter) *BlobIter { return &BlobIter{iter, s} } -// Next moves the iterator to the next blob and returns a pointer to it. If it -// has reached the end of the set it will return io.EOF. +// Next moves the iterator to the next blob and returns a pointer to it. If +// there are no more blobs, it returns io.EOF. func (iter *BlobIter) Next() (*Blob, error) { for { obj, err := iter.EncodedObjectIter.Next() |