Documentation ¶
Index ¶
- Constants
- func AscendingUintTuples(count int) (tuples [][2]val.Tuple, desc val.TupleDesc)
- func CloneRandomTuples(items [][2]val.Tuple) (clone [][2]val.Tuple)
- func OutputProllyNode(w io.Writer, node Node) error
- func PrintTreeSummaryByLevel(t *testing.T, nd Node, ns NodeStore)
- func RandomCompositeTuplePairs(count int, keyDesc, valDesc val.TupleDesc) (items [][2]val.Tuple)
- func RandomTuple(tb *val.TupleBuilder) (tup val.Tuple)
- func RandomTuplePairs(count int, keyDesc, valDesc val.TupleDesc) (items [][2]val.Tuple)
- func ShuffleTuplePairs(items [][2]val.Tuple)
- func SortTuplePairs(items [][2]val.Tuple, keyDesc val.TupleDesc)
- func ValueFromNode(root Node) types.Value
- func WalkAddresses(ctx context.Context, nd Node, ns NodeStore, cb AddressCb) error
- func WalkNodes(ctx context.Context, nd Node, ns NodeStore, cb NodeCb) error
- type AddressCb
- type Chunker
- type CollisionFn
- type CompareFn
- type Cursor
- func NewCursorAtEnd(ctx context.Context, ns NodeStore, nd Node) (cur *Cursor, err error)
- func NewCursorAtItem(ctx context.Context, ns NodeStore, nd Node, item Item, search ItemSearchFn) (cur *Cursor, err error)
- func NewCursorAtOrdinal(ctx context.Context, ns NodeStore, nd Node, ord uint64) (cur *Cursor, err error)
- func NewCursorAtStart(ctx context.Context, ns NodeStore, nd Node) (cur *Cursor, err error)
- func NewCursorFromCompareFn(ctx context.Context, ns NodeStore, n Node, i Item, compare CompareFn) (*Cursor, error)
- func NewCursorFromSearchFn(ctx context.Context, ns NodeStore, nd Node, search SearchFn) (cur *Cursor, err error)
- func NewCursorPastEnd(ctx context.Context, ns NodeStore, nd Node) (cur *Cursor, err error)
- func NewLeafCursorAtItem(ctx context.Context, ns NodeStore, nd Node, item Item, search ItemSearchFn) (cur Cursor, err error)
- func (cur *Cursor) Advance(ctx context.Context) (bool, error)
- func (cur *Cursor) Clone() *Cursor
- func (cur *Cursor) Compare(other *Cursor) int
- func (cur *Cursor) CurrentKey() Item
- func (cur *Cursor) CurrentRef() hash.Hash
- func (cur *Cursor) CurrentValue() Item
- func (cur *Cursor) Invalidate()
- func (cur *Cursor) Retreat(ctx context.Context) (bool, error)
- func (cur *Cursor) Valid() bool
- type Diff
- type DiffType
- type Differ
- type Item
- type ItemSearchFn
- type MutationIter
- type Node
- func ApplyMutations[S message.Serializer](ctx context.Context, ns NodeStore, root Node, serializer S, edits MutationIter, ...) (Node, error)
- func NewTupleLeafNode(keys, values []val.Tuple) Node
- func NodeFromBytes(msg []byte) Node
- func ThreeWayMerge[S message.Serializer](ctx context.Context, ns NodeStore, left, right, base Node, compare CompareFn, ...) (final Node, err error)
- type NodeCb
- type NodeStore
- type Samples
- type SearchFn
- type SubtreeCounts
Constants ¶
const ( // weibull params K = 4. // TODO: seems like this should be targetSize / math.Gamma(1 + 1/K). L = targetSize )
Variables ¶
This section is empty.
Functions ¶
func AscendingUintTuples ¶
Map<Tuple<Uint32>,Tuple<Uint32>>
func OutputProllyNode ¶
OutputProllyNode writes the node given to the writer given in a semi-human-readable format, where values are still displayed in hex-encoded byte strings, but are delineated into their fields. All nodes have keys displayed in this manner. Interior nodes have their child hash references spelled out, leaf nodes have value tuples delineated like the keys
func RandomTuple ¶
func RandomTuple(tb *val.TupleBuilder) (tup val.Tuple)
func RandomTuplePairs ¶
func ShuffleTuplePairs ¶
func ValueFromNode ¶
func WalkAddresses ¶
Types ¶
type Chunker ¶
type Chunker interface { AddPair(ctx context.Context, key, value Item) error Done(ctx context.Context) (Node, error) }
func NewEmptyChunker ¶
type CollisionFn ¶
CollisionFn is a callback that handles 3-way merging of NodeItems. A typical implementation will attempt a cell-wise merge of the tuples, or register a conflict if such a merge is not possible.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor explores a tree of Nodes.
func NewCursorAtEnd ¶
func NewCursorAtItem ¶
func NewCursorAtOrdinal ¶
func NewCursorAtStart ¶
func NewCursorFromCompareFn ¶
func NewCursorFromSearchFn ¶
func NewCursorPastEnd ¶
func NewLeafCursorAtItem ¶
func (*Cursor) CurrentKey ¶
func (*Cursor) CurrentRef ¶
func (*Cursor) CurrentValue ¶
func (*Cursor) Invalidate ¶
func (cur *Cursor) Invalidate()
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
func DifferFromRoots ¶
type ItemSearchFn ¶
type MutationIter ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func ApplyMutations ¶
func ApplyMutations[S message.Serializer]( ctx context.Context, ns NodeStore, root Node, serializer S, edits MutationIter, compare CompareFn, ) (Node, error)
func NewTupleLeafNode ¶
func NodeFromBytes ¶
func ThreeWayMerge ¶
func ThreeWayMerge[S message.Serializer]( ctx context.Context, ns NodeStore, left, right, base Node, compare CompareFn, collide CollisionFn, serializer S, ) (final Node, err error)
ThreeWayMerge implements a three-way merge algorithm using |base| as the common ancestor, |right| as the source branch, and |left| as the destination branch. Both |left| and |right| are diff'd against |base| to compute merge patches, but rather than applying both sets of patches to |base|, patches from |right| are applied directly to |left|. This reduces the amount of write work and improves performance. In the case that a key-value pair was modified on both |left| and |right| with different resulting values, the CollisionFn is called to perform a cell-wise merge, or to throw a conflict.
type NodeStore ¶
type NodeStore interface { // Read reads a prolly tree Node from the store. Read(ctx context.Context, ref hash.Hash) (Node, error) // Write writes a prolly tree Node to the store. Write(ctx context.Context, nd Node) (hash.Hash, error) // Pool returns a buffer pool. Pool() pool.BuffPool // Format returns the types.NomsBinFormat of this NodeStore. Format() *types.NomsBinFormat }
NodeStore reads and writes prolly tree Nodes.
func NewNodeStore ¶
func NewNodeStore(cs chunks.ChunkStore) NodeStore
NewNodeStore makes a new NodeStore.
func NewTestNodeStore ¶
func NewTestNodeStore() NodeStore
type SubtreeCounts ¶
type SubtreeCounts []uint64
func (SubtreeCounts) Sum ¶
func (sc SubtreeCounts) Sum() (s uint64)