Documentation ¶
Overview ¶
Package skiplist is a translation from LevelDBs skiplist (https://github.com/google/leveldb/blob/master/db/skiplist.h)
Index ¶
- Variables
- type BytesComparator
- type Comparator
- type Iterator
- type IteratorI
- type Map
- func (list *Map[K, V]) Contains(key K) bool
- func (list *Map[K, V]) Get(key K) (_ V, err error)
- func (list *Map[K, V]) Insert(key K, value V)
- func (list *Map[K, V]) Iterator() (IteratorI[K, V], error)
- func (list *Map[K, V]) IteratorBetween(keyLower K, keyHigher K) (IteratorI[K, V], error)
- func (list *Map[K, V]) IteratorStartingAt(key K) (IteratorI[K, V], error)
- func (list *Map[K, V]) Size() int
- type MapI
- type Node
- type NodeI
- type Ordered
- type OrderedComparator
Constants ¶
This section is empty.
Variables ¶
View Source
var Done = errors.New("no more items in iterator")
Done indicates an iterator has returned all items. https://github.com/GoogleCloudPlatform/google-cloud-go/wiki/Iterator-Guidelines
View Source
var NotFound = errors.New("key was not found")
Functions ¶
This section is empty.
Types ¶
type BytesComparator ¶
type BytesComparator struct { }
type Comparator ¶ added in v1.4.0
type Map ¶ added in v1.4.0
func (*Map[K, V]) IteratorBetween ¶ added in v1.4.0
func (*Map[K, V]) IteratorStartingAt ¶ added in v1.4.0
type MapI ¶ added in v1.4.0
type MapI[K any, V any] interface { Size() int // Insert key/value into the list. // REQUIRES: nothing that compares equal to key is currently in the list. Insert(key K, value V) // Contains returns true if an entry that compares equal to key is in the list. Contains(key K) bool // Get returns the value element that compares equal to the key supplied or returns NotFound if it does not exist. Get(key K) (V, error) // Iterator returns an iterator over the whole sorted sequence Iterator() (IteratorI[K, V], error) // IteratorStartingAt returns an iterator over the sorted sequence starting at the given key (inclusive if key is in the list). // Using a key that is out of the sequence range will result in either an empty iterator or the full sequence. IteratorStartingAt(key K) (IteratorI[K, V], error) // IteratorBetween Returns an iterator over the sorted sequence starting at the given keyLower (inclusive if key is in the list) // and until the given keyHigher was reached (inclusive if key is in the list). // Using keys that are out of the sequence range will result in either an empty iterator or the full sequence. // If keyHigher is lower than keyLower an error will be returned IteratorBetween(keyLower K, keyHigher K) (IteratorI[K, V], error) }
func NewSkipListMap ¶
func NewSkipListMap[K any, V any](comp Comparator[K]) MapI[K, V]
type Ordered ¶ added in v1.4.0
type Ordered interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | string }
Ordered represents the set of types for which the '<' and '>' operator work.
type OrderedComparator ¶ added in v1.4.0
type OrderedComparator[T Ordered] struct { }
func (OrderedComparator[T]) Compare ¶ added in v1.4.0
func (OrderedComparator[T]) Compare(a T, b T) int
Click to show internal directories.
Click to hide internal directories.