aboutsummaryrefslogtreecommitdiff
path: root/packfile/ingest/records.go
blob: 75f157fac887ce12374d096c25d050a211e33916 (about) (plain) (blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ingest

import (
	objectid "codeberg.org/lindenii/furgit/object/id"
	objecttype "codeberg.org/lindenii/furgit/object/type"
)

// objectRecord stores metadata for one packed object entry.
type objectRecord struct {
	// offset is the entry start offset in the pack file.
	offset uint64
	// headerLen is packed entry header length in bytes.
	headerLen uint32
	// packedLen is total packed entry length in bytes.
	packedLen uint64
	// crc32 is the CRC over the full packed entry.
	crc32 uint32
	// packedType is the entry type tag from the pack stream.
	packedType objecttype.Type
	// realType is canonical object type after delta resolution.
	realType objecttype.Type
	// declaredSize is the declared output object size for this entry.
	declaredSize int64
	// dataOffset is compressed payload start offset for this entry.
	dataOffset uint64
	// baseOffset is OFS base offset when packedType is OFS delta.
	baseOffset uint64
	// baseObject is REF base object ID when packedType is REF delta.
	baseObject objectid.ObjectID
	// objectID is final resolved object ID.
	objectID objectid.ObjectID
	// resolved reports whether objectID/realType are finalized.
	resolved bool
}

// ofsDeltaRef maps one OFS delta record to its base offset.
type ofsDeltaRef struct {
	baseOffset uint64
	recordIdx  int
}

// refDeltaRef maps one REF delta record to its base object ID.
type refDeltaRef struct {
	baseObject objectid.ObjectID
	recordIdx  int
}