MCPcopy
hub / github.com/dgraph-io/dgraph / ExactLen

Function ExactLen

codec/codec.go:427–440  ·  view source on GitHub ↗

ExactLen would calculate the total number of UIDs. Instead of using a UidPack, it accepts blocks, so we can calculate the number of uids after a seek.

(pack *pb.UidPack)

Source from the content-addressed store, hash-verified

425// ExactLen would calculate the total number of UIDs. Instead of using a UidPack, it accepts blocks,
426// so we can calculate the number of uids after a seek.
427func ExactLen(pack *pb.UidPack) int {
428 if pack == nil {
429 return 0
430 }
431 sz := len(pack.Blocks)
432 if sz == 0 {
433 return 0
434 }
435 num := 0
436 for _, b := range pack.Blocks {
437 num += int(b.NumUids) // NumUids includes the base UID.
438 }
439 return num
440}
441
442// Decode decodes the UidPack back into the list of uids. This is a stop-gap function, Decode would
443// need to do more specific things than just return the list back.

Callers 9

toListMethod · 0.92
writeIndexMethod · 0.92
historyFunction · 0.92
immutableLayerLenMethod · 0.92
IntersectSortedPackedFunction · 0.92
MergeSortedPackedFunction · 0.92
TestUidPackFunction · 0.85
TestBufferUidPackFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestUidPackFunction · 0.68
TestBufferUidPackFunction · 0.68