MCPcopy Create free account
hub / github.com/dgraph-io/dgraph-benchmarks / ExactLen

Function ExactLen

bitmap/codec.go:392–405  ·  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 *UidPack)

Source from the content-addressed store, hash-verified

390// ExactLen would calculate the total number of UIDs. Instead of using a UidPack, it accepts blocks,
391// so we can calculate the number of uids after a seek.
392func ExactLen(pack *UidPack) int {
393 if pack == nil {
394 return 0
395 }
396 sz := len(pack.Blocks)
397 if sz == 0 {
398 return 0
399 }
400 num := 0
401 for _, b := range pack.Blocks {
402 num += int(b.NumUids) // NumUids includes the base UID.
403 }
404 return num
405}
406
407// Decode decodes the UidPack back into the list of uids. This is a stop-gap function, Decode would
408// need to do more specific things than just return the list back.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected