aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/layerinfo.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-06 10:57:15 +0800
committerGravatar Runxi Yu2026-03-06 10:57:15 +0800
commitbd9ca0ee6f4645d31335d63d35d3b495afa32cc5 (patch)
tree5462b7dc5f218e373b47091f4aba488b697a38e9 /format/commitgraph/layerinfo.go
parentconfig: Split files (diff)
signatureNo signature
format/commitgraph: Split layer files
Diffstat (limited to 'format/commitgraph/layerinfo.go')
-rw-r--r--format/commitgraph/layerinfo.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/format/commitgraph/layerinfo.go b/format/commitgraph/layerinfo.go
new file mode 100644
index 00000000..f5750368
--- /dev/null
+++ b/format/commitgraph/layerinfo.go
@@ -0,0 +1,23 @@
+package commitgraph
+
+// 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.
+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
+}