Documentation ¶
Index ¶
- Variables
- type Builder
- type Entry
- type Index
- type Iterator
- type Node
- type Operator
- func (o *Operator) Delete(ctx context.Context, s cadata.Store, root Root, key []byte) (*Root, error)
- func (o *Operator) Get(ctx context.Context, s cadata.Store, root Root, key []byte) ([]byte, error)
- func (o *Operator) MinEntry(ctx context.Context, s cadata.Store, root Root, gteq []byte) (*Entry, error)
- func (o *Operator) New(ctx context.Context, s cadata.Store, ents []*Entry) (*Root, error)
- func (o *Operator) NewBuilder(s cadata.Store, batchSize int) *Builder
- func (o *Operator) NewIterator(s cadata.Store, root Root, span Span) *Iterator
- func (o *Operator) Populate(ctx context.Context, s cadata.Store, root Root, set cadata.Set, ...) error
- func (o *Operator) Put(ctx context.Context, s cadata.Store, root Root, key, value []byte) (*Root, error)
- func (o *Operator) PutBatch(ctx context.Context, s cadata.Store, root Root, ents []*Entry) (*Root, error)
- func (o *Operator) Sync(ctx context.Context, dst, src cadata.Store, root Root, fn func(*Entry) error) error
- func (o *Operator) Validate(ctx context.Context, s cadata.Store, x Root) error
- func (o *Operator) Walk(ctx context.Context, s cadata.Store, root Root, w Walker) error
- type Ref
- type Root
- type Span
- type Walker
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotExist = errors.Errorf("no entry for key") ErrCannotCollapse = errors.Errorf("cannot collapse parent into child") ErrCannotSplit = errors.Errorf("cannot split, < 2 entries") )
var File_trie_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*Entry) Descriptor
deprecated
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) ProtoReflect ¶
func (x *Entry) ProtoReflect() protoreflect.Message
type Index ¶
type Index struct { Ref []byte `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` IsParent bool `protobuf:"varint,2,opt,name=is_parent,json=isParent,proto3" json:"is_parent,omitempty"` Count uint64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` // contains filtered or unexported fields }
func (*Index) Descriptor
deprecated
func (*Index) GetIsParent ¶
func (*Index) ProtoMessage ¶
func (*Index) ProtoMessage()
func (*Index) ProtoReflect ¶
func (x *Index) ProtoReflect() protoreflect.Message
type Node ¶
type Node struct { Entries []*Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` // contains filtered or unexported fields }
func (*Node) Descriptor
deprecated
func (*Node) GetEntries ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
func (*Node) ProtoReflect ¶
func (x *Node) ProtoReflect() protoreflect.Message
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
func NewOperator ¶
func NewOperator() *Operator
func (*Operator) Delete ¶
func (o *Operator) Delete(ctx context.Context, s cadata.Store, root Root, key []byte) (*Root, error)
Delete removes
func (*Operator) MinEntry ¶
func (o *Operator) MinEntry(ctx context.Context, s cadata.Store, root Root, gteq []byte) (*Entry, error)
MinEntry returns the first entry >= gteq
func (*Operator) NewIterator ¶
func (*Operator) Put ¶
func (o *Operator) Put(ctx context.Context, s cadata.Store, root Root, key, value []byte) (*Root, error)
Put returns a copy of root where key maps to value, and all other mappings are unchanged.
func (*Operator) PutBatch ¶
func (o *Operator) PutBatch(ctx context.Context, s cadata.Store, root Root, ents []*Entry) (*Root, error)
PutBatch performs a batch of put operations on ents atomically, returning a new instance reflecting the changes.
func (*Operator) Sync ¶
func (o *Operator) Sync(ctx context.Context, dst, src cadata.Store, root Root, fn func(*Entry) error) error
Sync ensures that data structure exists in dst, using src to retrieve missing pieces. Sync is only correct if dangling references can be guarenteed to not exist in dst.
func (*Operator) Walk ¶
Walk walks a Trie calling methods on Walker throughout the traversal. w.ShouldWalk is called before walking a node, if false is returned the node is skipped w.EntryFn is called for every entry in a node w.NodeFn is called for the node after all the entries reachable from it have been walked.