Documentation
¶
Index ¶
- type AdaptiveRadixTree
- func (art *AdaptiveRadixTree) Close() error
- func (art *AdaptiveRadixTree) Delete(key []byte) bool
- func (art *AdaptiveRadixTree) Get(key []byte) *data.LogRecordPos
- func (art *AdaptiveRadixTree) Iterator(reverse bool) Iterator
- func (art *AdaptiveRadixTree) Put(key []byte, pos *data.LogRecordPos) bool
- func (art *AdaptiveRadixTree) Size() int
- type BPlusTree
- type BTree
- type IndexType
- type Indexer
- type Item
- type Iterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptiveRadixTree ¶
type AdaptiveRadixTree struct {
// contains filtered or unexported fields
}
AdaptiveRadixTree 自适应基数树索引 主要封装了 https://github.com/plar/go-adaptive-radix-tree 库
func (*AdaptiveRadixTree) Close ¶
func (art *AdaptiveRadixTree) Close() error
func (*AdaptiveRadixTree) Delete ¶
func (art *AdaptiveRadixTree) Delete(key []byte) bool
func (*AdaptiveRadixTree) Get ¶
func (art *AdaptiveRadixTree) Get(key []byte) *data.LogRecordPos
func (*AdaptiveRadixTree) Iterator ¶
func (art *AdaptiveRadixTree) Iterator(reverse bool) Iterator
func (*AdaptiveRadixTree) Put ¶
func (art *AdaptiveRadixTree) Put(key []byte, pos *data.LogRecordPos) bool
func (*AdaptiveRadixTree) Size ¶
func (art *AdaptiveRadixTree) Size() int
type BPlusTree ¶
type BPlusTree struct {
// contains filtered or unexported fields
}
BPlusTree B+ 树索引 主要封装了 go.etcd.io/bbolt 库
func NewBPlusTree ¶
NewBPlusTree 初始化 B+ 树索引
type BTree ¶
type BTree struct {
// contains filtered or unexported fields
}
BTree 索引,主要封装了 google 的 btree ku https://github.com/google/btree
type Indexer ¶
type Indexer interface {
// Put 向索引中存储key对应的数据的位置信息
Put(key []byte, pos *data.LogRecordPos) bool
// Get 根据key取出对应的索引位置信息
Get(key []byte) *data.LogRecordPos
// Delete 根据key删除对应的索引位置信息
Delete(key []byte) bool
// Size 索引中的数据量
Size() int
// Iterator 迭代器
Iterator(reverse bool) Iterator
// Close 关闭索引
Close() error
}
抽象索引接口,目前接入google的btree,后续如果要更换其他数据结构,则可以直接实现这个接口
type Iterator ¶
type Iterator interface {
// Rewind 重新回到迭代器的起点,即第一个数据
Rewind()
// Seek 根据传入的 key 查找到第一个大于(或小于)等于的目标 key,根据从这个 key 开始遍历
Seek(key []byte)
// Next 跳转到下一个 key
Next()
// Valid 是否有效,即是否已经遍历完了所有的 key,用于退出遍历
Valid() bool
// Key 当前遍历位置的 Key 数据
Key() []byte
// Value 当前遍历位置的 Value 数据
Value() *data.LogRecordPos
// Close 关闭迭代器,释放相应资源
Close()
}
Iterator 通用索引迭代器
Click to show internal directories.
Click to hide internal directories.