MCPcopy Create free account
hub / github.com/brimdata/super / GetPoolStats

Function GetPoolStats

runtime/exec/stats.go:21–48  ·  view source on GitHub ↗
(ctx context.Context, p *db.Pool, snap commits.View)

Source from the content-addressed store, hash-verified

19}
20
21func GetPoolStats(ctx context.Context, p *db.Pool, snap commits.View) (info PoolStats, err error) {
22 // XXX this doesn't scale... it should be stored in the snapshot and is
23 // not easy to compute in the face of deletes...
24 var poolSpan *extent.Generic
25 for _, object := range snap.Select(nil, p.SortKeys.Primary().Order) {
26 info.Size += object.Size
27 if poolSpan == nil {
28 poolSpan = extent.NewGenericFromOrder(object.Min, object.Max, order.Asc)
29 } else {
30 poolSpan.Extend(object.Min)
31 poolSpan.Extend(object.Max)
32 }
33 }
34 //XXX need to change API to take return key range
35 if poolSpan != nil {
36 min := poolSpan.First()
37 if min.Type() == super.TypeTime {
38 firstTs := super.DecodeTime(min.Bytes())
39 lastTs := super.DecodeTime(poolSpan.Last().Bytes())
40 if lastTs < firstTs {
41 firstTs, lastTs = lastTs, firstTs
42 }
43 span := nano.NewSpanTs(firstTs, lastTs+1)
44 info.Span = &span
45 }
46 }
47 return info, err
48}
49
50type BranchStats struct {
51 Size int64 `super:"size"`

Callers 1

handlePoolStatsFunction · 0.92

Calls 10

ExtendMethod · 0.95
FirstMethod · 0.95
LastMethod · 0.95
NewGenericFromOrderFunction · 0.92
DecodeTimeFunction · 0.92
NewSpanTsFunction · 0.92
PrimaryMethod · 0.80
SelectMethod · 0.65
TypeMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected