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

Method LinearSeek

codec/codec.go:349–359  ·  view source on GitHub ↗

LinearSeek returns uids of the last block whose base is less than seek. If there are no such blocks i.e. seek < base of first block, it returns uids of first block. LinearSeek is used to get closest uids which are >= seek.

(seek uint64)

Source from the content-addressed store, hash-verified

347// If there are no such blocks i.e. seek < base of first block, it returns uids of first
348// block. LinearSeek is used to get closest uids which are >= seek.
349func (d *Decoder) LinearSeek(seek uint64) []uint64 {
350 for {
351 v := d.PeekNextBase()
352 if seek < v {
353 break
354 }
355 d.blockIdx++
356 }
357
358 return d.UnpackBlock()
359}
360
361// PeekNextBase returns the base of the next block without advancing the decoder.
362func (d *Decoder) PeekNextBase() uint64 {

Callers 4

TestSeekFunction · 0.95
TestLinearSeekFunction · 0.95

Calls 2

PeekNextBaseMethod · 0.95
UnpackBlockMethod · 0.95

Tested by 2

TestSeekFunction · 0.76
TestLinearSeekFunction · 0.76