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 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
Click to show internal directories.
Click to hide internal directories.