index

package
v0.0.0-...-932458b Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package index defines common interface and errors for indexing implementations to use.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound should be returned from lookup operations when the
	// lookup key is not found in index/store.
	ErrKeyNotFound = errors.New("key not found")

	// ErrKeyTooLarge is returned by index implementations when a key is
	// larger than a configured limit if any.
	ErrKeyTooLarge = errors.New("key is too large")

	// ErrEmptyKey should be returned by backends when an operation is
	// requested with an empty key.
	ErrEmptyKey = errors.New("empty key")

	// ErrImmutable should be returned by backends when write operation
	// (put/del) is attempted on a readonly.
	ErrImmutable = errors.New("operation not allowed in read-only mode")
)

Functions

func Checksum

func Checksum(d []byte) uint32

Checksum returns CRC32 checksum for given data.

func PackKV

func PackKV(k, v []byte) []byte

PackKV returns a slice with key-value packed together.

func UnpackKV

func UnpackKV(blob []byte, keySz int) (k, v []byte)

UnpackKV unpacks a blob of binary data into key and value.

Types

type Index

type Index interface {
	Get(key []byte) (uint64, error)
	Del(key []byte) (uint64, error)
	Put(key []byte, v uint64) error
}

Index represents the indexing scheme to be used by Kiwi database instance.

type Scanner

type Scanner interface {
	Index
	Scan(beginKey []byte, reverse bool, scanFn func(key []byte, v uint64) bool) error
}

Scanner represents indexing schemes with support for prefix scans.

Directories

Path Synopsis
Package bptree implements an on-disk B+ tree indexing scheme that can store key-value pairs and provide fast lookups and range scans.
Package bptree implements an on-disk B+ tree indexing scheme that can store key-value pairs and provide fast lookups and range scans.

Jump to

Keyboard shortcuts

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