Documentation
¶
Index ¶
- func NewBTreeBitmap(a ...uint64) *roaring.Bitmap
- type BTCIterator
- type BTreeContainers
- func (btc *BTreeContainers) Clone() roaring.Containers
- func (btc *BTreeContainers) Get(key uint64) *roaring.Container
- func (btc *BTreeContainers) GetOrCreate(key uint64) *roaring.Container
- func (btc *BTreeContainers) Iterator(key uint64) (citer roaring.ContainerIterator, found bool)
- func (btc *BTreeContainers) Last() (key uint64, c *roaring.Container)
- func (btc *BTreeContainers) Put(key uint64, c *roaring.Container)
- func (btc *BTreeContainers) PutContainerValues(key uint64, containerType byte, n int, mapped bool)
- func (btc *BTreeContainers) Remove(key uint64)
- func (btc *BTreeContainers) Size() int
- type Cmp
- type Enumerator
- type Tree
- func (t *Tree) Clear()
- func (t *Tree) Close()
- func (t *Tree) Delete(k uint64) (ok bool)
- func (t *Tree) First() (k uint64, v *roaring.Container)
- func (t *Tree) Get(k uint64) (v *roaring.Container, ok bool)
- func (t *Tree) Last() (k uint64, v *roaring.Container)
- func (t *Tree) Len() int
- func (t *Tree) Put(k uint64, ...) (oldV *roaring.Container, written bool)
- func (t *Tree) Seek(k uint64) (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 uint64, v *roaring.Container)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBTreeBitmap ¶
Types ¶
type BTCIterator ¶
type BTCIterator struct {
// contains filtered or unexported fields
}
func (*BTCIterator) Next ¶
func (i *BTCIterator) Next() bool
type BTreeContainers ¶
type BTreeContainers struct {
// contains filtered or unexported fields
}
func NewBTreeContainers ¶
func NewBTreeContainers() *BTreeContainers
func (*BTreeContainers) Clone ¶
func (btc *BTreeContainers) Clone() roaring.Containers
func (*BTreeContainers) GetOrCreate ¶
func (btc *BTreeContainers) GetOrCreate(key uint64) *roaring.Container
func (*BTreeContainers) Iterator ¶
func (btc *BTreeContainers) Iterator(key uint64) (citer roaring.ContainerIterator, found bool)
func (*BTreeContainers) Last ¶
func (btc *BTreeContainers) Last() (key uint64, c *roaring.Container)
func (*BTreeContainers) PutContainerValues ¶
func (btc *BTreeContainers) PutContainerValues(key uint64, containerType byte, n int, mapped bool)
func (*BTreeContainers) Remove ¶
func (btc *BTreeContainers) Remove(key uint64)
func (*BTreeContainers) Size ¶
func (btc *BTreeContainers) Size() int
type Enumerator ¶
type Enumerator struct {
// contains filtered or unexported fields
}
Enumerator captures the state of enumerating a tree. It is returned from the Seek* methods. The enumerator is aware of any mutations made to the tree in the process of enumerating it and automatically resumes the enumeration at the proper key, if possible.
However, once an Enumerator returns io.EOF to signal "no more items", it does no more attempt to "resync" on tree mutation(s). In other words, io.EOF from an Enumerator is "sticky" (idempotent).
func (*Enumerator) Close ¶
func (e *Enumerator) Close()
Close recycles e to a pool for possible later reuse. No references to e should exist or such references must not be used afterwards.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a B+tree.
func TreeNew ¶
TreeNew returns a newly created, empty Tree. The compare function is used for key collation.
func (*Tree) Close ¶
func (t *Tree) Close()
Close performs Clear and recycles t to a pool for possible later reuse. No references to t should exist or such references must not be used afterwards.
func (*Tree) Delete ¶
Delete removes the k's KV pair, if it exists, in which case Delete returns true.
func (*Tree) First ¶
First returns the first item of the tree in the key collating order, or (zero-value, zero-value) if the tree is empty.
func (*Tree) Get ¶
Get returns the value associated with k and true if it exists. Otherwise Get returns (zero-value, false).
func (*Tree) Last ¶
Last returns the last item of the tree in the key collating order, or (zero-value, zero-value) if the tree is empty.
func (*Tree) Put ¶
func (t *Tree) Put(k uint64, upd func(oldV *roaring.Container, exists bool) (newV *roaring.Container, write bool)) (oldV *roaring.Container, written bool)
Put combines Get and Set in a more efficient way where the tree is walked only once. The upd(ater) receives (old-value, true) if a KV pair for k exists or (zero-value, false) otherwise. It can then return a (new-value, true) to create or overwrite the existing value in the KV pair, or (whatever, false) if it decides not to create or not to update the value of the KV pair.
tree.Set(k, v) call conceptually equals calling
tree.Put(k, func(uint64, bool){ return v, true })
modulo the differing return values.
func (*Tree) Seek ¶
func (t *Tree) Seek(k uint64) (e *Enumerator, ok bool)
Seek returns an Enumerator positioned on 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.