File: object.go

package info (click to toggle)
golang-github-git-lfs-gitobj 2.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 432 kB
  • sloc: makefile: 2; sh: 1
file content (27 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package pack

// Object is an encapsulation of an object found in a packfile, or a packed
// object.
type Object struct {
	// data is the front-most element of the delta-base chain, and when
	// resolved, yields the uncompressed data of this object.
	data Chain
	// typ is the underlying object's type. It is not the type of the
	// front-most chain element, rather, the type of the actual object.
	typ PackedObjectType
}

// Unpack resolves the delta-base chain and returns an uncompressed, unpacked,
// and full representation of the data encoded by this object.
//
// If there was any error in unpacking this object, it is returned immediately,
// and the object's data can be assumed to be corrupt.
func (o *Object) Unpack() ([]byte, error) {
	return o.data.Unpack()
}

// Type returns the underlying object's type. Rather than the type of the
// front-most delta-base component, it is the type of the object itself.
func (o *Object) Type() PackedObjectType {
	return o.typ
}