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

Function DecodeToBuffer

codec/codec.go:456–467  ·  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().

(buf *z.Buffer, pack *pb.UidPack)

Source from the content-addressed store, hash-verified

454// DecodeToBuffer is the same as Decode but it returns a z.Buffer which is
455// calloc'ed and can be SHOULD be freed up by calling buffer.Release().
456func DecodeToBuffer(buf *z.Buffer, pack *pb.UidPack) {
457 var last uint64
458 tmp := make([]byte, 16)
459 dec := Decoder{Pack: pack}
460 for uids := dec.Seek(0, SeekStart); len(uids) > 0; uids = dec.Next() {
461 for _, u := range uids {
462 n := binary.PutUvarint(tmp, u-last)
463 x.Check2(buf.Write(tmp[:n]))
464 last = u
465 }
466 }
467}
468
469func match32MSB(num1, num2 uint64) bool {
470 return (num1 & bitMask) == (num2 & bitMask)

Callers 2

ToBackupPostingListMethod · 0.92
TestBufferUidPackFunction · 0.85

Calls 4

SeekMethod · 0.95
NextMethod · 0.95
Check2Function · 0.92
WriteMethod · 0.65

Tested by 1

TestBufferUidPackFunction · 0.68