rbtree

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 4

README

RBTree

Red/Black tree on-disk implementation with go

Documentation

Index

Constants

View Source
const (
	FV_COLOR_BLACK flagVaue = 0b00000000
	FV_COLOR_RED   flagVaue = 0b00000001
)
View Source
const (
	FT_COLOR flagType = 0
)

Variables

View Source
var ErrInvalidKeySize = errors.New("invalid key size")
View Source
var ErrInvalidPointer = errors.New("invalid pointer")
View Source
var ErrKeyAlreadyExists = errors.New("key already exists")
View Source
var ErrNilPtr = errors.New("nil pointer")
View Source
var ErrNodeFetch = errors.New("failed to fetch node")
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type DummyVal

type DummyVal struct{}

func (*DummyVal) Copy

func (v *DummyVal) Copy() EntryItem

func (*DummyVal) IsNil

func (v *DummyVal) IsNil() bool

func (*DummyVal) MarshalBinary

func (v *DummyVal) MarshalBinary() ([]byte, error)

func (*DummyVal) New

func (v *DummyVal) New() EntryItem

func (*DummyVal) Size

func (v *DummyVal) Size() int

func (*DummyVal) UnmarshalBinary

func (v *DummyVal) UnmarshalBinary([]byte) error

type Entry

type Entry[K, V EntryItem] struct {
	Key K
	Val V
}

func (*Entry[K, V]) Copy

func (e *Entry[K, V]) Copy() *Entry[K, V]

func (*Entry[K, V]) MarshalBinary

func (e *Entry[K, V]) MarshalBinary() ([]byte, error)

func (*Entry[K, V]) Size

func (e *Entry[K, V]) Size() int

func (*Entry[K, V]) UnmarshalBinary

func (e *Entry[K, V]) UnmarshalBinary(d []byte) error

type EntryItem

type EntryItem interface {
	New() EntryItem
	Copy() EntryItem
	Size() int
	IsNil() bool
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

type Options

type Options struct {
	PageSize uint16
}

type RBTree

type RBTree[K, V EntryItem] struct {
	// contains filtered or unexported fields
}

func Open

func Open[K, V EntryItem](fileName string, opts *Options) (*RBTree[K, V], error)

func (*RBTree[K, V]) Close

func (tree *RBTree[K, V]) Close() error

func (*RBTree[K, V]) Count

func (tree *RBTree[K, V]) Count() int

func (*RBTree[K, V]) Delete

func (tree *RBTree[K, V]) Delete(key K) error

func (*RBTree[K, V]) DeleteMem

func (tree *RBTree[K, V]) DeleteMem(key K) error

func (*RBTree[K, V]) Get

func (tree *RBTree[K, V]) Get(key K) (*Entry[K, V], error)

func (*RBTree[K, V]) Insert

func (tree *RBTree[K, V]) Insert(e *Entry[K, V]) error

func (*RBTree[K, V]) InsertMem

func (tree *RBTree[K, V]) InsertMem(e *Entry[K, V]) error

func (*RBTree[K, V]) Print

func (tree *RBTree[K, V]) Print(count int) error

func (*RBTree[K, V]) Remove

func (tree *RBTree[K, V]) Remove()

func (*RBTree[K, V]) Scan

func (tree *RBTree[K, V]) Scan(key K, scanFn func(key K, val V) (bool, error)) error

func (*RBTree[K, V]) WriteAll

func (tree *RBTree[K, V]) WriteAll() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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