Documentation ¶
Index ¶
- Variables
- type Object
- func (o *Object) Close() error
- func (o *Object) Hash() core.Hash
- func (o *Object) Reader() (core.ObjectReader, error)
- 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() (core.ObjectWriter, error)
- 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) Close ¶
Close releases any resources consumed by the object when it is acting as a core.ObjectWriter.
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 ¶
func (o *Object) Reader() (core.ObjectReader, error)
Reader returns a core.ObjectReader used to read the object's 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
func (*Object) Writer ¶
func (o *Object) Writer() (core.ObjectWriter, error)
Writer returns a core.ObjectWriter used to write the object's content.
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