aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/read/layerinfo.go
blob: d4dbfad395517d6be96656659a4414e1bf43a644 (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
package read

// LayerInfo describes one loaded commit-graph layer.
type LayerInfo struct {
	Path      string
	BaseCount uint32
	Commits   uint32
}

// Layers returns loaded layer metadata in native chain order.
//
// Labels: Life-Independent.
func (reader *Reader) Layers() []LayerInfo {
	out := make([]LayerInfo, 0, len(reader.layers))
	for i := range reader.layers {
		layer := reader.layers[i]
		out = append(out, LayerInfo{
			Path:      layer.path,
			BaseCount: layer.baseCount,
			Commits:   layer.numCommits,
		})
	}

	return out
}