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

Function ApproxLen

codec/codec.go:418–423  ·  view source on GitHub ↗

ApproxLen would indicate the total number of UIDs in the pack. Can be used for int slice allocations.

(pack *pb.UidPack)

Source from the content-addressed store, hash-verified

416// ApproxLen would indicate the total number of UIDs in the pack. Can be used for int slice
417// allocations.
418func ApproxLen(pack *pb.UidPack) int {
419 if pack == nil {
420 return 0
421 }
422 return len(pack.Blocks) * int(pack.BlockSize)
423}
424
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.

Callers 3

ApproxLenMethod · 0.92
DecodeFunction · 0.85
TestUidPackFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestUidPackFunction · 0.68