index

package
v0.0.0-...-032be59 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BTree

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

BTree: encapsulate btree by Google, support concurrent write To use the methods provided by Google BTree, we need to implement Item interface in the Google BTree Library After we implement the Item interface, we need to implement the Indexer interface

func NewBTree

func NewBTree() *BTree

Init a new BTree instance

func (*BTree) Delete

func (bt *BTree) Delete(key []byte) bool

Implement the Delete function in the Indexer interface

func (*BTree) Get

func (bt *BTree) Get(key []byte) *data.LogRecordPos

Implement the Get function in the Indexer interface, Get method in Google BTree is thread safe

func (*BTree) Put

func (bt *BTree) Put(key []byte, pos *data.LogRecordPos) bool

Implement the Put function in the Indexer interface, lock the write opertions when perform write

type Indexer

type Indexer interface {
	Put(key []byte, pos *data.LogRecordPos) bool
	Get(key []byte) *data.LogRecordPos
	Delete(key []byte) bool
}

type Item

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

Item: implement the Item Interface in Google BTree in order to use the methods provided by Google BTree

func (*Item) Less

func (operandOne *Item) Less(operandTwo btree.Item) bool

Implement the method in the btree.Item interface, -1 means the key of operand one is strictly less than the key of operand two

Jump to

Keyboard shortcuts

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