MCPcopy Index your code
hub / github.com/dgraph-io/dgraph-benchmarks / DecodeToBuffer

Function DecodeToBuffer

bitmap/codec.go:421–437  ·  view source on GitHub ↗

DecodeToBuffer is the same as Decode but it returns a z.Buffer which is calloc'ed and can be SHOULD be freed up by calling buffer.Release().

(pack *UidPack, seek uint64)

Source from the content-addressed store, hash-verified

419// DecodeToBuffer is the same as Decode but it returns a z.Buffer which is
420// calloc'ed and can be SHOULD be freed up by calling buffer.Release().
421func DecodeToBuffer(pack *UidPack, seek uint64) *z.Buffer {
422 buf, err := z.NewBufferWith(256<<20, 32<<30, z.UseCalloc)
423 Check(err)
424 buf.AutoMmapAfter(1 << 30)
425
426 var last uint64
427 tmp := make([]byte, 16)
428 dec := Decoder{Pack: pack}
429 for uids := dec.Seek(seek, SeekStart); len(uids) > 0; uids = dec.Next() {
430 for _, u := range uids {
431 n := binary.PutUvarint(tmp, u-last)
432 Check2(buf.Write(tmp[:n]))
433 last = u
434 }
435 }
436 return buf
437}
438
439func match32MSB(num1, num2 uint64) bool {
440 return (num1 & bitMask) == (num2 & bitMask)

Callers

nothing calls this directly

Calls 5

SeekMethod · 0.95
NextMethod · 0.95
CheckFunction · 0.85
Check2Function · 0.85
WriteMethod · 0.80

Tested by

no test coverage detected