Documentation
¶
Index ¶
- Variables
- type BTree
- func (tr *BTree) ByIndex(index IndexType) (KeyType, ValueType, error)
- func (tr *BTree) CreateEmpty(tag interface{}) (TreeIndex, error)
- func (tr *BTree) Delete(tag interface{}, treeIndex TreeIndex, key KeyType) error
- func (tr *BTree) Find(treeIndex TreeIndex, key KeyType) (ValueType, IndexType, error)
- func (tr *BTree) FreeTree(treeIndex TreeIndex, ignoreReadOnly bool) error
- func (tr *BTree) Insert(tag interface{}, treeIndex TreeIndex, key KeyType, value ValueType, ...) error
- func (tr *BTree) LowerBound(treeIndex TreeIndex, key KeyType) (KeyType, ValueType, IndexType, error)
- func (tr *BTree) Open(bf blockfile.BlockAllocator) error
- func (tr *BTree) Scan(treeIndex TreeIndex, startKey KeyType, ...) (bool, error)
- func (tr *BTree) WriteRecords(tag interface{}, data map[string]ValueType) (TreeIndex, error)
- type IndexType
- type KeyType
- type KeyValuePair
- type TreeIndex
- type ValueType
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorKeyAlreadyExists = errors.New("key already exists")
View Source
var ErrorKeyNotFound = errors.New("key not found")
View Source
var ErrorRootImmutable = errors.New("root block is immutable")
Functions ¶
This section is empty.
Types ¶
type BTree ¶
type BTree struct {
// Maximum size in bytes of a key
MaxKeySize int
// Size in bytes of a value
EntrySize int
// The number of keys stored at each B-tree node. Each node has up to FanOut+1
// child nodes. FanOut must be set to an even number. Set FanOut to 0 to have
// it automatically set to the largest possible when calling Open().
FanOut int
// contains filtered or unexported fields
}
Represents a B-tree structure. Set the public variables then call Init(). You can then start querying or writing records to the tree.
func (*BTree) CreateEmpty ¶
func (*BTree) LowerBound ¶
func (*BTree) Open ¶
func (tr *BTree) Open(bf blockfile.BlockAllocator) error
Open a B-tree with a single writable block allocator.
func (*BTree) Scan ¶
func (tr *BTree) Scan(treeIndex TreeIndex, startKey KeyType, entryCallback func(index IndexType, key KeyType, value ValueType) bool) (bool, error)
Start scanning entries at the given offset (pass 0 to start at the beginning). Scan() will invoke entryCallback for each entry. If entryCallback returns false the scan will terminate. A scan can be resumed starting at a given entry by passing back the offset parameter sent to the callback function.
type KeyValuePair ¶
Click to show internal directories.
Click to hide internal directories.