Documentation ¶
Index ¶
- type Enumerator
- type Temp
- type Tree
- func (t *Tree) Clear()
- func (t *Tree) Delete(k []interface{}) (ok bool)
- func (t *Tree) First() (k []interface{}, v []interface{})
- func (t *Tree) Get(k []interface{}) (v []interface{}, ok bool)
- func (t *Tree) Last() (k []interface{}, v []interface{})
- func (t *Tree) Len() int
- func (t *Tree) Seek(k []interface{}) (e *Enumerator, ok bool)
- func (t *Tree) SeekFirst() (e *Enumerator, err error)
- func (t *Tree) SeekLast() (e *Enumerator, err error)
- func (t *Tree) Set(k []interface{}, v []interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Enumerator ¶
type Enumerator struct {
// contains filtered or unexported fields
}
Enumerator is the iterator for btree
func (*Enumerator) Next ¶
func (e *Enumerator) Next() (k []interface{}, v []interface{}, err error)
Next returns the currently enumerated item, if it exists and moves to the next item in the key collation order. If there is no item to return, err == io.EOF is returned.
func (*Enumerator) Prev ¶
func (e *Enumerator) Prev() (k []interface{}, v []interface{}, err error)
Prev returns the currently enumerated item, if it exists and moves to the previous item in the key collation order. If there is no item to return, err == io.EOF is returned.
type Temp ¶
type Temp interface { Drop() (err error) Get(k []interface{}) (v []interface{}, err error) SeekFirst() (e btreeIterator, err error) Set(k, v []interface{}) (err error) }
Temp is the interface of a memory kv storage
func CreateTemp ¶
CreateTemp returns a new empty memory kv
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a B+tree.
func NewTree ¶
func NewTree(cmp cmp) *Tree
NewTree returns a newly created, empty tree. The compare function is used for key collation.
func (*Tree) Delete ¶
Delete removes the k's KV pair, if it exists, in which case Delete returns true.
func (*Tree) First ¶
func (t *Tree) First() (k []interface{}, v []interface{})
First returns the first item of the tree in the key collating order, or (nil, nil) if the tree is empty.
func (*Tree) Get ¶
Get returns the value associated with k and true if it exists. Otherwise Get returns (nil, false).
func (*Tree) Last ¶
func (t *Tree) Last() (k []interface{}, v []interface{})
Last returns the last item of the tree in the key collating order, or (nil, nil) if the tree is empty.
func (*Tree) Seek ¶
func (t *Tree) Seek(k []interface{}) (e *Enumerator, ok bool)
Seek returns an Enumerator positioned on a an item such that k >= item's key. ok reports if k == item.key The Enumerator's position is possibly after the last item in the tree.
func (*Tree) SeekFirst ¶
func (t *Tree) SeekFirst() (e *Enumerator, err error)
SeekFirst returns an Enumerator positioned on the first KV pair in the tree, if any. For an empty tree, err == io.EOF is returned and e will be nil.
func (*Tree) SeekLast ¶
func (t *Tree) SeekLast() (e *Enumerator, err error)
SeekLast returns an Enumerator positioned on the last KV pair in the tree, if any. For an empty tree, err == io.EOF is returned and e will be nil.