MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Count

Method Count

internal/utils/kvstore/table.go:282–302  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

280}
281
282func (this *Table[T]) Count() (int64, error) {
283 var count int64
284
285 var begin = this.FullKeyBytes(nil)
286 it, err := this.db.store.rawDB.NewIter(&pebble.IterOptions{
287 LowerBound: begin,
288 UpperBound: append(begin, 0xFF),
289 })
290 if err != nil {
291 return 0, err
292 }
293 defer func() {
294 _ = it.Close()
295 }()
296
297 for it.First(); it.Valid(); it.Next() {
298 count++
299 }
300
301 return count, err
302}
303
304func (this *Table[T]) FullKey(realKey string) []byte {
305 return append(this.Namespace(), KeyPrefix+realKey...)

Callers

nothing calls this directly

Calls 3

FullKeyBytesMethod · 0.95
NextMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected