ordered

package
v0.0.0-...-81f4bad Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection[K any, V any] interface {
	Iterable[K, V]
	Get(K) (V, bool) // Get value from key
	Put(K, V)        // Insert node
	Delete(K)        // Insert node with DELETE marker
	Clear()
	Size() uint
}

A key-value balanced tree data structure

func Rbt

func Rbt[K any, V any](comp func(K, K) int) Collection[K, V]

type Iterable

type Iterable[K any, V any] interface {
	Keys() <-chan K
	Values() <-chan V
}

Iterable specifies a struct that may return an Iterator

type Iterator

type Iterator[V any] interface {
	HasNext() bool
	Next() V
}

A smallest-to-largest Node iterator

type Node

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

func (*Node[K, V]) String

func (node *Node[K, V]) String() string

type RedBlackTree

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

func (*RedBlackTree[K, V]) Clear

func (rbt *RedBlackTree[K, V]) Clear()

func (*RedBlackTree[K, V]) Delete

func (rbt *RedBlackTree[K, V]) Delete(key K)

func (*RedBlackTree[K, V]) Get

func (rbt *RedBlackTree[K, V]) Get(key K) (V, bool)

func (*RedBlackTree[K, V]) Keys

func (rbt *RedBlackTree[K, V]) Keys() <-chan K

func (*RedBlackTree[K, V]) Put

func (rbt *RedBlackTree[K, V]) Put(key K, val V)

Insert or update value at key

func (*RedBlackTree[K, V]) Restore

func (rbt *RedBlackTree[K, V]) Restore(entry wal.LogEntry)

func (*RedBlackTree[K, V]) Size

func (rbt *RedBlackTree[K, V]) Size() uint

func (*RedBlackTree[K, V]) Values

func (rbt *RedBlackTree[K, V]) Values() <-chan V

Jump to

Keyboard shortcuts

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