badger: github.com/dgraph-io/badger/skl Index | Files

package skl

import "github.com/dgraph-io/badger/skl"

Index

Package Files

arena.go skl.go

Constants

const MaxNodeSize = int(unsafe.Sizeof(node{}))

MaxNodeSize is the memory footprint of a node of maximum height.

type Arena Uses

type Arena struct {
    // contains filtered or unexported fields
}

Arena should be lock-free.

type Iterator Uses

type Iterator struct {
    // contains filtered or unexported fields
}

Iterator is an iterator over skiplist object. For new objects, you just need to initialize Iterator.list.

func (*Iterator) Close Uses

func (s *Iterator) Close() error

Close frees the resources held by the iterator

func (*Iterator) Key Uses

func (s *Iterator) Key() []byte

Key returns the key at the current position.

func (*Iterator) Next Uses

func (s *Iterator) Next()

Next advances to the next position.

func (*Iterator) Prev Uses

func (s *Iterator) Prev()

Prev advances to the previous position.

func (*Iterator) Seek Uses

func (s *Iterator) Seek(target []byte)

Seek advances to the first entry with a key >= target.

func (*Iterator) SeekForPrev Uses

func (s *Iterator) SeekForPrev(target []byte)

SeekForPrev finds an entry with key <= target.

func (*Iterator) SeekToFirst Uses

func (s *Iterator) SeekToFirst()

SeekToFirst seeks position at the first entry in list. Final state of iterator is Valid() iff list is not empty.

func (*Iterator) SeekToLast Uses

func (s *Iterator) SeekToLast()

SeekToLast seeks position at the last entry in list. Final state of iterator is Valid() iff list is not empty.

func (*Iterator) Valid Uses

func (s *Iterator) Valid() bool

Valid returns true iff the iterator is positioned at a valid node.

func (*Iterator) Value Uses

func (s *Iterator) Value() y.ValueStruct

Value returns value.

func (*Iterator) ValueUint64 Uses

func (s *Iterator) ValueUint64() uint64

ValueUint64 returns the uint64 value of the current node.

type Skiplist Uses

type Skiplist struct {
    OnClose func()
    // contains filtered or unexported fields
}

func NewSkiplist Uses

func NewSkiplist(arenaSize int64) *Skiplist

NewSkiplist makes a new empty skiplist, with a given arena size

func (*Skiplist) DecrRef Uses

func (s *Skiplist) DecrRef()

DecrRef decrements the refcount, deallocating the Skiplist when done using it

func (*Skiplist) Empty Uses

func (s *Skiplist) Empty() bool

Empty returns if the Skiplist is empty.

func (*Skiplist) Get Uses

func (s *Skiplist) Get(key []byte) y.ValueStruct

Get gets the value associated with the key. It returns a valid value if it finds equal or earlier version of the same key.

func (*Skiplist) IncrRef Uses

func (s *Skiplist) IncrRef()

IncrRef increases the refcount

func (*Skiplist) MemSize Uses

func (s *Skiplist) MemSize() int64

MemSize returns the size of the Skiplist in terms of how much memory is used within its internal arena.

func (*Skiplist) NewIterator Uses

func (s *Skiplist) NewIterator() *Iterator

NewIterator returns a skiplist iterator. You have to Close() the iterator.

func (*Skiplist) NewUniIterator Uses

func (s *Skiplist) NewUniIterator(reversed bool) *UniIterator

NewUniIterator returns a UniIterator.

func (*Skiplist) Put Uses

func (s *Skiplist) Put(key []byte, v y.ValueStruct)

Put inserts the key-value pair.

type UniIterator Uses

type UniIterator struct {
    // contains filtered or unexported fields
}

UniIterator is a unidirectional memtable iterator. It is a thin wrapper around Iterator. We like to keep Iterator as before, because it is more powerful and we might support bidirectional iterators in the future.

func (*UniIterator) Close Uses

func (s *UniIterator) Close() error

Close implements y.Interface (and frees up the iter's resources)

func (*UniIterator) Key Uses

func (s *UniIterator) Key() []byte

Key implements y.Interface

func (*UniIterator) Next Uses

func (s *UniIterator) Next()

Next implements y.Interface

func (*UniIterator) Rewind Uses

func (s *UniIterator) Rewind()

Rewind implements y.Interface

func (*UniIterator) Seek Uses

func (s *UniIterator) Seek(key []byte)

Seek implements y.Interface

func (*UniIterator) Valid Uses

func (s *UniIterator) Valid() bool

Valid implements y.Interface

func (*UniIterator) Value Uses

func (s *UniIterator) Value() y.ValueStruct

Value implements y.Interface

Package skl imports 5 packages (graph) and is imported by 25 packages. Updated 2021-01-19. Refresh now. Tools for package owners.