Documentation ¶
Index ¶
- type Copy
- func (c *Copy) All(key []byte) *List
- func (c *Copy) Cursor() *Cursor
- func (c *Copy) Cut(key []byte) *Item
- func (c *Copy) Del(ver uint64, key []byte) *Item
- func (c *Copy) Get(ver uint64, key []byte) *Item
- func (c *Copy) Put(ver uint64, key, val []byte) *Item
- func (c *Copy) Root() *Node
- func (c *Copy) Size() int
- func (c *Copy) Tree() *Tree
- type Cursor
- type Find
- type Item
- type List
- func (l *List) Clr()
- func (l *List) Del(ver uint64, meth Find) *Item
- func (l *List) Exp(ver uint64, meth Find) *Item
- func (l *List) Get(ver uint64, meth Find) *Item
- func (l *List) Len() int
- func (l *List) Max() *Item
- func (l *List) Min() *Item
- func (l *List) Put(ver uint64, val []byte) *Item
- func (l *List) Rng(beg, end uint64, fn func(*Item) bool)
- func (l *List) Walk(fn func(*Item) bool)
- type Node
- type Tree
- type Walker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Copy ¶
type Copy struct {
// contains filtered or unexported fields
}
Copy is a copy of a tree which can be used to apply changes to the radix tree. All changes are applied atomically and a new tree is returned when committed. A Copy is not thread safe.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents an iterator that can traverse over all key-value pairs in a tree in sorted order. Cursors can be obtained from a transaction and are valid as long as the transaction is open. Changing data while traversing with a cursor may cause it to be invalidated and return unexpected keys and/or values. You must reposition your cursor after mutating data.
func (*Cursor) Del ¶
Del removes the current item under the cursor from the tree. If the cursor has not yet been positioned using First, Last, or Seek, then no item is deleted and a nil key and value are returned.
func (*Cursor) First ¶
First moves the cursor to the first item in the tree and returns its key and value. If the tree is empty then a nil key and value are returned.
func (*Cursor) Here ¶
Here moves the cursor to the first item in the tree and returns its key and value. If the tree is empty then a nil key and value are returned.
func (*Cursor) Last ¶
Last moves the cursor to the last item in the tree and returns its key and value. If the tree is empty then a nil key and value are returned.
func (*Cursor) Next ¶
Next moves the cursor to the next item in the tree and returns its key and value. If the tree is empty then a nil key and value are returned, and if the cursor is at the end of the tree then a nil key and value are returned. If the cursor has not yet been positioned using First, Last, or Seek, then a nil key and value are returned.
func (*Cursor) Prev ¶
Prev moves the cursor to the previous item in the tree and returns its key and value. If the tree is empty then a nil key and value are returned, and if the cursor is at the start of the tree then a nil key and value are returned. If the cursor has not yet been positioned using First, Last, or Seek, then a nil key and value are returned.
type Find ¶
type Find int8
Find determines which method is used to seek items in the list.
const ( // Exact returns an item at a specific version from the list. If the exact // item does not exist in the list, then a nil value is returned. Exact Find = iota // Prev returns the nearest item in the list, where the version number is // less than the given version. In a time-series list, this can be used // to get the version that was valid before a specified time. Prev // Next returns the nearest item in the list, where the version number is // greater than the given version. In a time-series list, this can be used // to get the version that was changed after a specified time. Next // Upto returns the nearest item in the list, where the version number is // less than or equal to the given version. In a time-series list, this can // be used to get the version that was current at the specified time. Upto // Nearest returns an item nearest a specific version in the list. If there // is a previous version to the given version, then it will be returned, // otherwise it will return the next available version. Nearest )
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents an item in a time-series list.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents a doubly-linked time-series list.
func (*List) Del ¶
Del deletes a specific item from the list, returning the previous item if it existed. If it did not exist, a nil value is returned.
func (*List) Exp ¶
Exp expunges all items in the list, upto and including the specified version, returning the latest version, or a nil value if not found.
func (*List) Get ¶
Get gets a specific item from the list. If the exact item does not exist in the list, then a nil value is returned.
func (*List) Max ¶
Max returns the last item in the list. In a time-series list this can be used to get the latest version.
func (*List) Min ¶
Min returns the first item in the list. In a time-series list this can be used to get the initial version.
func (*List) Put ¶
Put inserts a new item into the list, ensuring that the list is sorted after insertion. If an item with the same version already exists in the list, then the value is updated.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents an immutable node in the radix tree which can be either an edge node or a leaf node.
func (*Node) Max ¶
Max returns the key and value of the maximum item in the subtree of the current node.
func (*Node) Min ¶
Min returns the key and value of the minimum item in the subtree of the current node.
func (*Node) Path ¶
Path is used to recurse over the tree only visiting nodes which are above this node in the tree.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree represents an immutable versioned radix tree.