Imported Upstream version 2.4.2
[scm/test.git] / vendor / github.com / git-lfs / gitobj / pack / object.go
1 package pack
2
3 // Object is an encapsulation of an object found in a packfile, or a packed
4 // object.
5 type Object struct {
6         // data is the front-most element of the delta-base chain, and when
7         // resolved, yields the uncompressed data of this object.
8         data Chain
9         // typ is the underlying object's type. It is not the type of the
10         // front-most chain element, rather, the type of the actual object.
11         typ PackedObjectType
12 }
13
14 // Unpack resolves the delta-base chain and returns an uncompressed, unpacked,
15 // and full representation of the data encoded by this object.
16 //
17 // If there was any error in unpacking this object, it is returned immediately,
18 // and the object's data can be assumed to be corrupt.
19 func (o *Object) Unpack() ([]byte, error) {
20         return o.data.Unpack()
21 }
22
23 // Type returns the underlying object's type. Rather than the type of the
24 // front-most delta-base component, it is the type of the object itself.
25 func (o *Object) Type() PackedObjectType {
26         return o.typ
27 }