skiplist

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

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

Iterator support

func (*Iterator) Close

func (it *Iterator) Close() error

func (*Iterator) Domain

func (it *Iterator) Domain() (start, end []byte)

func (*Iterator) Error

func (it *Iterator) Error() error

func (*Iterator) IsDeleted

func (it *Iterator) IsDeleted() bool

func (*Iterator) Key

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

func (*Iterator) KeyCopy

func (it *Iterator) KeyCopy(dst []byte) []byte

func (*Iterator) Next

func (it *Iterator) Next()

func (*Iterator) Seek

func (it *Iterator) Seek(key []byte)

func (*Iterator) UnsafeEntry

func (it *Iterator) UnsafeEntry() ([]byte, page.ValuePtr, byte)

func (*Iterator) UnsafeKey

func (it *Iterator) UnsafeKey() []byte

func (*Iterator) UnsafeValue

func (it *Iterator) UnsafeValue() []byte

func (*Iterator) Valid

func (it *Iterator) Valid() bool

func (*Iterator) Value

func (it *Iterator) Value() []byte

func (*Iterator) ValueCopy

func (it *Iterator) ValueCopy(dst []byte) []byte

type SkipList

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

SkipList is an arena-backed skiplist using chunked memory to eliminate resizing copy costs.

func New

func New(capacity int) *SkipList

New creates a new SkipList.

func (*SkipList) Append

func (s *SkipList) Append(key, value []byte)

Append inserts a new key/value entry assuming the key is strictly greater than the current maximum key in the skiplist.

func (*SkipList) AppendDelete

func (s *SkipList) AppendDelete(key []byte)

AppendDelete inserts a tombstone for key assuming the key is strictly greater than the current maximum key in the skiplist.

func (*SkipList) AppendWithCallback

func (s *SkipList) AppendWithCallback(key, value []byte, flags uint8, cb func(k, v []byte) error) error

AppendWithCallback inserts a new entry assuming the key is strictly greater than the current maximum key in the skiplist.

func (*SkipList) Count

func (s *SkipList) Count() int

func (*SkipList) Delete

func (s *SkipList) Delete(key []byte)

Delete marks a key as deleted (tombstone).

func (*SkipList) DeleteWithCallback

func (s *SkipList) DeleteWithCallback(key []byte, cb func(k, v []byte) error) error

DeleteWithCallback marks deleted with callback.

func (*SkipList) Get

func (s *SkipList) Get(key []byte) ([]byte, bool, bool)

Get returns value, isDeleted, exists

func (*SkipList) GetEntry added in v0.2.0

func (s *SkipList) GetEntry(key []byte) ([]byte, page.ValuePtr, byte, bool)

GetEntry returns the raw entry, including pointer and flags, if present.

func (*SkipList) LastKey

func (s *SkipList) LastKey() []byte

LastKey returns the largest key currently in the skiplist, or nil if empty.

func (*SkipList) NewIterator

func (s *SkipList) NewIterator(start, end []byte) *Iterator

func (*SkipList) Put

func (s *SkipList) Put(key, value []byte)

Put inserts or updates a key.

func (*SkipList) PutEntry added in v0.2.0

func (s *SkipList) PutEntry(key, value []byte, ptr page.ValuePtr, flags byte)

PutEntry inserts key/value with explicit flags and optional value pointer. When flags include FlagPointer, ptr is encoded into the value area; if value is non-nil, it is appended after the pointer bytes.

func (*SkipList) PutWithCallback

func (s *SkipList) PutWithCallback(key, value []byte, cb func(k, v []byte) error) error

PutWithCallback inserts key/value, calling cb with views into the arena before linking.

func (*SkipList) Reset

func (s *SkipList) Reset()

Reset clears all entries while retaining the allocated arena capacity. This allows the skiplist to be reused without incurring new allocations.

func (*SkipList) Size

func (s *SkipList) Size() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL