package skl
import "github.com/dgraph-io/badger/v2/skl"
Index ¶
- Constants
- type Arena
- type Iterator
- func (s *Iterator) Close() error
- func (s *Iterator) Key() []byte
- func (s *Iterator) Next()
- func (s *Iterator) Prev()
- func (s *Iterator) Seek(target []byte)
- func (s *Iterator) SeekForPrev(target []byte)
- func (s *Iterator) SeekToFirst()
- func (s *Iterator) SeekToLast()
- func (s *Iterator) Valid() bool
- func (s *Iterator) Value() y.ValueStruct
- type Skiplist
- func NewSkiplist(arenaSize int64) *Skiplist
- func (s *Skiplist) DecrRef()
- func (s *Skiplist) Empty() bool
- func (s *Skiplist) Get(key []byte) y.ValueStruct
- func (s *Skiplist) IncrRef()
- func (s *Skiplist) MemSize() int64
- func (s *Skiplist) NewIterator() *Iterator
- func (s *Skiplist) NewUniIterator(reversed bool) *UniIterator
- func (s *Skiplist) Put(key []byte, v y.ValueStruct)
- type UniIterator
Constants ¶
MaxNodeSize is the memory footprint of a node of maximum height.
Types ¶
type Arena ¶
type Arena struct {
// contains filtered or unexported fields
}
Arena should be lock-free.
type Iterator ¶
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 ¶
Close frees the resources held by the iterator
func (*Iterator) Key ¶
Key returns the key at the current position.
func (*Iterator) Next ¶
func (s *Iterator) Next()
Next advances to the next position.
func (*Iterator) Prev ¶
func (s *Iterator) Prev()
Prev advances to the previous position.
func (*Iterator) Seek ¶
Seek advances to the first entry with a key >= target.
func (*Iterator) SeekForPrev ¶
SeekForPrev finds an entry with key <= target.
func (*Iterator) SeekToFirst ¶
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 ¶
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 ¶
Valid returns true iff the iterator is positioned at a valid node.
func (*Iterator) Value ¶
func (s *Iterator) Value() y.ValueStruct
Value returns value.
type Skiplist ¶
type Skiplist struct {
// contains filtered or unexported fields
}
Skiplist maps keys to values (in memory)
func NewSkiplist ¶
NewSkiplist makes a new empty skiplist, with a given arena size
func (*Skiplist) DecrRef ¶
func (s *Skiplist) DecrRef()
DecrRef decrements the refcount, deallocating the Skiplist when done using it
func (*Skiplist) Empty ¶
Empty returns if the Skiplist is empty.
func (*Skiplist) Get ¶
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 ¶
func (s *Skiplist) IncrRef()
IncrRef increases the refcount
func (*Skiplist) MemSize ¶
MemSize returns the size of the Skiplist in terms of how much memory is used within its internal arena.
func (*Skiplist) NewIterator ¶
NewIterator returns a skiplist iterator. You have to Close() the iterator.
func (*Skiplist) NewUniIterator ¶
func (s *Skiplist) NewUniIterator(reversed bool) *UniIterator
NewUniIterator returns a UniIterator.
func (*Skiplist) Put ¶
func (s *Skiplist) Put(key []byte, v y.ValueStruct)
Put inserts the key-value pair.
type UniIterator ¶
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 ¶
func (s *UniIterator) Close() error
Close implements y.Interface (and frees up the iter's resources)
func (*UniIterator) Key ¶
func (s *UniIterator) Key() []byte
Key implements y.Interface
func (*UniIterator) Next ¶
func (s *UniIterator) Next()
Next implements y.Interface
func (*UniIterator) Rewind ¶
func (s *UniIterator) Rewind()
Rewind implements y.Interface
func (*UniIterator) Seek ¶
func (s *UniIterator) Seek(key []byte)
Seek implements y.Interface
func (*UniIterator) Valid ¶
func (s *UniIterator) Valid() bool
Valid implements y.Interface
func (*UniIterator) Value ¶
func (s *UniIterator) Value() y.ValueStruct
Value implements y.Interface
Source Files ¶
- Version
- v2.2007.4 (latest)
- Published
- Aug 25, 2021
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 week ago –
Tools for package owners.