skiplist

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Skiplist

skiplist is a high-performance Go library implementing the skip list data structure with a unique deterministic level assignment. Instead of relying on randomization, this library assigns levels based on insertion count, offering a predictable and structured approach. Each level is represented using a memory-mapped file, ensuring efficient storage and quick access, even for large datasets. Skip lists provide an excellent alternative to balanced trees, delivering fast search, insertion, and deletion operations with average-case O(log n) performance. With skiplist, you can harness the power of skip lists with enhanced predictability and memory efficiency, perfect for applications requiring scalable and performant data management.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("entry not found")
)

Functions

This section is empty.

Types

type Entry

type Entry[K Key, V any] struct {
	Key   K
	Value V
}

type Key

type Key interface {
	Compare(any) int
}

type Skiplist

type Skiplist[K Key, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K Key, V any](name, dir string, size int64) (out *Skiplist[K, V], err error)

func (*Skiplist[K, V]) Close

func (s *Skiplist[K, V]) Close() (err error)

func (*Skiplist[K, V]) Get

func (s *Skiplist[K, V]) Get(key K) (value V, err error)

func (*Skiplist[K, V]) Set

func (s *Skiplist[K, V]) Set(key *K, val *V) (err error)

func (*Skiplist[K, V]) SetNX

func (s *Skiplist[K, V]) SetNX(key *K, val *V) (err error)

type Varchar16

type Varchar16 [16]byte

func MakeVarchar16

func MakeVarchar16(str string) (out Varchar16)

func (Varchar16) Compare

func (v Varchar16) Compare(in any) (result int)

func (Varchar16) String

func (v Varchar16) String() string

type Varchar32

type Varchar32 [32]byte

func MakeVarchar32

func MakeVarchar32(str string) (out Varchar32)

func (Varchar32) Compare

func (v Varchar32) Compare(in any) (result int)

func (Varchar32) String

func (v Varchar32) String() string

type Varchar64

type Varchar64 [64]byte

func MakeVarchar64

func MakeVarchar64(str string) (out Varchar64)

func (Varchar64) Compare

func (v Varchar64) Compare(in any) (result int)

func (Varchar64) String

func (v Varchar64) String() string

type Varchar128

type Varchar128 [128]byte

func MakeVarchar128

func MakeVarchar128(str string) (out Varchar128)

func (Varchar128) Compare

func (v Varchar128) Compare(in any) (result int)

func (Varchar128) String

func (v Varchar128) String() string

Jump to

Keyboard shortcuts

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