index

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Indexer

type Indexer interface {
	// Put key and position into the index.
	Put(key []byte, position *wal.ChunkPosition) *wal.ChunkPosition

	// Get the position of the key in the index.
	Get(key []byte) *wal.ChunkPosition

	// Delete the index of the key.
	Delete(key []byte) (*wal.ChunkPosition, bool)

	// Size represents the number of keys in the index.
	Size() int
}

Indexer is an interface for indexing key and position. It is used to store the key and the position of the data in the WAL. The index will be rebuilt when the database is opened. You can implement your own indexer by implementing this interface.

func NewIndexer

func NewIndexer() Indexer

type IndexerType

type IndexerType = byte
const (
	BTree IndexerType = iota
)

type MemoryBTree added in v1.0.4

type MemoryBTree struct {
	// contains filtered or unexported fields
}

MemoryBTree is a memory based btree implementation of the Index interface It is a wrapper around the google/btree package: github.com/google/btree

func (*MemoryBTree) Delete added in v1.0.4

func (mt *MemoryBTree) Delete(key []byte) (*wal.ChunkPosition, bool)

func (*MemoryBTree) Get added in v1.0.4

func (mt *MemoryBTree) Get(key []byte) *wal.ChunkPosition

func (*MemoryBTree) Put added in v1.0.4

func (mt *MemoryBTree) Put(key []byte, position *wal.ChunkPosition) *wal.ChunkPosition

func (*MemoryBTree) Size added in v1.0.4

func (mt *MemoryBTree) Size() int

Jump to

Keyboard shortcuts

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