Documentation ¶
Index ¶
- Variables
- type Object
- func (o *Object) Hash() core.Hash
- func (o *Object) Reader() io.Reader
- func (o *Object) SetSize(s int64)
- func (o *Object) SetType(t core.ObjectType)
- func (o *Object) Size() int64
- func (o *Object) Type() core.ObjectType
- func (o *Object) Write(p []byte) (n int, err error)
- func (o *Object) Writer() io.Writer
- type ObjectStorage
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object on memory core.Object implementation
func (*Object) Hash ¶
Hash return the object Hash, the hash is calculated on-the-fly the first time is called, the subsequent calls the same Hash is returned even in the type or the content has changed. The Hash is only generated if the size of the content is exactly the Object.Size
func (*Object) Reader ¶
Reader returns a io.Reader used to read the object content
func (*Object) SetSize ¶
SetSize set the object size, the given size should be written afterwards
func (*Object) SetType ¶
func (o *Object) SetType(t core.ObjectType)
SetType sets the core.ObjectType
type ObjectStorage ¶
type ObjectStorage struct { Objects map[core.Hash]core.Object Commits map[core.Hash]core.Object Trees map[core.Hash]core.Object Blobs map[core.Hash]core.Object Tags map[core.Hash]core.Object }
ObjectStorage is the implementation of core.ObjectStorage for memory.Object
func NewObjectStorage ¶
func NewObjectStorage() *ObjectStorage
NewObjectStorage returns a new empty ObjectStorage
func (*ObjectStorage) Get ¶
Get returns a object with the given hash
func (*ObjectStorage) Iter ¶
func (o *ObjectStorage) Iter(t core.ObjectType) core.ObjectIter
Iter returns a core.ObjectIter for the given core.ObjectTybe
func (*ObjectStorage) New ¶
func (o *ObjectStorage) New() (core.Object, error)
New returns a new empty memory.Object