Documentation ¶
Index ¶
- Variables
- func Compare(a, b []byte) int
- type ARTreeIterator
- func (artree *ARTreeIterator) Close()
- func (artree *ARTreeIterator) Key() []byte
- func (artree *ARTreeIterator) Next()
- func (artree *ARTreeIterator) Rewind()
- func (artree *ARTreeIterator) Seek(key []byte)
- func (artree *ARTreeIterator) Valid() bool
- func (artree *ARTreeIterator) Value() *data.LogRecordPst
- type AdaptiveRadixTree
- func (artree *AdaptiveRadixTree) Delete(key []byte) bool
- func (artree *AdaptiveRadixTree) Get(key []byte) *data.LogRecordPst
- func (artree *AdaptiveRadixTree) Iterator(reverse bool) Iterator
- func (artree *AdaptiveRadixTree) Put(key []byte, pst *data.LogRecordPst) bool
- func (artree *AdaptiveRadixTree) Size() int
- type BPlusTree
- type BTree
- type BtreeIterator
- type IndexType
- type Indexer
- type Item
- type Iterator
- type SkipList
- type SkipListIterator
Constants ¶
This section is empty.
Variables ¶
var ( ErrOpenBPTreeFailed = errors.New("OpenBPTreeFailedError : failed to open bptree") ErrCreateBucketFailed = errors.New("CreateBucketFailedError : failed to create bucket in bptree") ErrPutValueFailed = errors.New("PutValueFailedError : failed to put value in bptree") ErrGetValueFailed = errors.New("GetValueFailedError : failed to get value in bptree") ErrDeleteValueFailed = errors.New("DeleteValueFailedError : failed to delete value in bptree") ErrGetIndexSizeFailed = errors.New("GetIndexSizeFailedError : failed to get index size in bptree") ErrBeginTxFailed = errors.New("BeginTxFailedError : failed to begin tx in bptree") ErrRollbackTxFailed = errors.New("RollbackTxFailedError : failed to rollback tx in bptree") )
Functions ¶
Types ¶
type ARTreeIterator ¶
type ARTreeIterator struct {
// contains filtered or unexported fields
}
ART Index iterator
func NewARTreeIterator ¶
func NewARTreeIterator(tree art.Tree, reverse bool) *ARTreeIterator
func (*ARTreeIterator) Close ¶
func (artree *ARTreeIterator) Close()
func (*ARTreeIterator) Key ¶
func (artree *ARTreeIterator) Key() []byte
func (*ARTreeIterator) Next ¶
func (artree *ARTreeIterator) Next()
func (*ARTreeIterator) Rewind ¶
func (artree *ARTreeIterator) Rewind()
func (*ARTreeIterator) Seek ¶
func (artree *ARTreeIterator) Seek(key []byte)
func (*ARTreeIterator) Valid ¶
func (artree *ARTreeIterator) Valid() bool
func (*ARTreeIterator) Value ¶
func (artree *ARTreeIterator) Value() *data.LogRecordPst
type AdaptiveRadixTree ¶
type AdaptiveRadixTree struct {
// contains filtered or unexported fields
}
Adaptive Radix Tree Index The following link is the ART library written by go. If you need to know more about it, please go to the corresponding warehouse. https://github.com/plar/go-adaptive-radix-tree
func (*AdaptiveRadixTree) Delete ¶
func (artree *AdaptiveRadixTree) Delete(key []byte) bool
func (*AdaptiveRadixTree) Get ¶
func (artree *AdaptiveRadixTree) Get(key []byte) *data.LogRecordPst
func (*AdaptiveRadixTree) Iterator ¶
func (artree *AdaptiveRadixTree) Iterator(reverse bool) Iterator
func (*AdaptiveRadixTree) Put ¶
func (artree *AdaptiveRadixTree) Put(key []byte, pst *data.LogRecordPst) bool
func (*AdaptiveRadixTree) Size ¶
func (artree *AdaptiveRadixTree) Size() int
type BPlusTree ¶
type BPlusTree struct {
// contains filtered or unexported fields
}
BPlusTree B+ Tree Index go.etcd.io/bbolt This is the library that encapsulates b+ tree Again, if you need to look at the source code for b+ trees, The following link is a good place to start https://github.com/etcd-io/bbolt
func NewBPlusTree ¶
NewBPlusTree Initializes the B+ tree index
func (*BPlusTree) Delete ¶
Delete Deletes the key-value pair corresponding to the key from the B+ tree index The argument to the Delete method is required to be a byte array The argument is the key, and the return value is a bool value If the key does not exist, false is returned
func (*BPlusTree) Get ¶
func (bptree *BPlusTree) Get(key []byte) *data.LogRecordPst
Get Gets the value corresponding to the key from the B+ tree index The argument to the Get method is required to be a byte array The argument is the key, and the return value is the value corresponding to the key If the key does not exist, nil is returned
func (*BPlusTree) Iterator ¶
Iterator Gets the iterator of the B+ tree index The argument to the Iterator method is required to be a bool value The argument is the traversal direction of the iterator, and the return value is an iterator If the argument is true, the iterator is traversed in reverse order, otherwise it is traversed in order
func (*BPlusTree) Put ¶
func (bptree *BPlusTree) Put(key []byte, pst *data.LogRecordPst) bool
Put Inserts a key-value pair into the B+ tree index The two arguments to the Put method The first argument is the key, and the second argument is the value The key is the primary key of the data, and the value is the offset of the data in the data file
type BtreeIterator ¶
type BtreeIterator struct {
// contains filtered or unexported fields
}
BTreeIterator represents an iterator for BTree index.
func NewBTreeIterator ¶
func NewBTreeIterator(tree *btree.BTree, reverse bool) *BtreeIterator
func (*BtreeIterator) Close ¶
func (bi *BtreeIterator) Close()
func (*BtreeIterator) Key ¶
func (bi *BtreeIterator) Key() []byte
func (*BtreeIterator) Next ¶
func (bi *BtreeIterator) Next()
func (*BtreeIterator) Rewind ¶
func (bi *BtreeIterator) Rewind()
func (*BtreeIterator) Seek ¶
func (bi *BtreeIterator) Seek(key []byte)
func (*BtreeIterator) Valid ¶
func (bi *BtreeIterator) Valid() bool
func (*BtreeIterator) Value ¶
func (bi *BtreeIterator) Value() *data.LogRecordPst
type Indexer ¶
type Indexer interface { // Put stores the position information of the key in the index. Put(key []byte, pst *data.LogRecordPst) bool // Get retrieves the position information of the key from the index. Get(key []byte) *data.LogRecordPst // Delete deletes the position information of the key from the index. Delete(key []byte) bool // Size returns the number of entries in the index. Size() int // Iterator returns an iterator for the index. Iterator(reverse bool) Iterator }
Indexer index interface abstraction layer. If you want to access other data structures, you can directly implement this interface
func NewIndexer ¶
type Iterator ¶
type Iterator interface { // Rewind resets the iterator to the beginning, i.e., the first entry. Rewind() // Seek seeks to a target key that is >= or <= the given key, depending on the implementation. Seek(key []byte) // Next moves to the next key. Next() // Valid returns whether the iterator is still valid, i.e., if all keys have been traversed. Valid() bool // Key returns the key at the current iterator position. Key() []byte // Value returns the value (position information) at the current iterator position. Value() *data.LogRecordPst // Close closes the iterator and releases any resources. Close() }
Iterator is a generic index iterator.
type SkipList ¶ added in v1.0.8
type SkipList struct {
// contains filtered or unexported fields
}
SkipList Memory Index based on https://github.com/chen3feng/stl4go
func NewSkipList ¶ added in v1.0.8
func NewSkipList() *SkipList
NewSkipList Initialize the SkipList index
func (*SkipList) Delete ¶ added in v1.0.8
Delete Deletes the key-value pair corresponding to the key from the SkipList index
func (*SkipList) Get ¶ added in v1.0.8
func (sl *SkipList) Get(key []byte) *data.LogRecordPst
Get Gets the value corresponding to the key from the SkipList index
func (*SkipList) Iterator ¶ added in v1.0.8
Iterator Gets the iterator of the SkipList index If the reverse is true, the iterator is traversed in reverse order, otherwise it is traversed in order
type SkipListIterator ¶ added in v1.0.8
type SkipListIterator struct {
// contains filtered or unexported fields
}
func NewSkipListIterator ¶ added in v1.0.8
func NewSkipListIterator(sl *SkipList, reverse bool) *SkipListIterator
NewSkipListIterator Initializes the SkipList index iterator
func (*SkipListIterator) Close ¶ added in v1.0.8
func (sl *SkipListIterator) Close()
Close Closes the iterator
func (*SkipListIterator) Key ¶ added in v1.0.8
func (sl *SkipListIterator) Key() []byte
Key Gets the key at the current iterator position
func (*SkipListIterator) Next ¶ added in v1.0.8
func (sl *SkipListIterator) Next()
Next Positions the iterator to the next key If the iterator is positioned at the last key, the iterator is positioned to the start of the iterator
func (*SkipListIterator) Rewind ¶ added in v1.0.8
func (sl *SkipListIterator) Rewind()
Rewind Resets the iterator to the beginning
func (*SkipListIterator) Seek ¶ added in v1.0.8
func (sl *SkipListIterator) Seek(key []byte)
Seek Positions the iterator to the first key that is greater or equal to the specified key
func (*SkipListIterator) Valid ¶ added in v1.0.8
func (sl *SkipListIterator) Valid() bool
Valid Determines whether the iterator is positioned at a valid key
func (*SkipListIterator) Value ¶ added in v1.0.8
func (sl *SkipListIterator) Value() *data.LogRecordPst
Value Gets the value at the current iterator position