Documentation ¶
Index ¶
- Variables
- type Child
- func (*Child) Descriptor() ([]byte, []int)
- func (m *Child) GetIndex() []byte
- func (m *Child) Marshal() (dAtA []byte, err error)
- func (m *Child) MarshalTo(dAtA []byte) (int, error)
- func (m *Child) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Child) ProtoMessage()
- func (m *Child) Reset()
- func (m *Child) Size() (n int)
- func (m *Child) String() string
- func (m *Child) Unmarshal(dAtA []byte) error
- func (m *Child) XXX_DiscardUnknown()
- func (m *Child) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Child) XXX_Merge(src proto.Message)
- func (m *Child) XXX_Size() int
- func (m *Child) XXX_Unmarshal(b []byte) error
- type Leaf
- func (*Leaf) Descriptor() ([]byte, []int)
- func (m *Leaf) GetLeaf() *Child
- func (m *Leaf) Marshal() (dAtA []byte, err error)
- func (m *Leaf) MarshalTo(dAtA []byte) (int, error)
- func (m *Leaf) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Leaf) ProtoMessage()
- func (m *Leaf) Reset()
- func (m *Leaf) Size() (n int)
- func (m *Leaf) String() string
- func (m *Leaf) Unmarshal(dAtA []byte) error
- func (m *Leaf) XXX_DiscardUnknown()
- func (m *Leaf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Leaf) XXX_Merge(src proto.Message)
- func (m *Leaf) XXX_Size() int
- func (m *Leaf) XXX_Unmarshal(b []byte) error
- type Node
- func (*Node) Descriptor() ([]byte, []int)
- func (m *Node) GetChildren() []*Child
- func (m *Node) Marshal() (dAtA []byte, err error)
- func (m *Node) MarshalTo(dAtA []byte) (int, error)
- func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Node) ProtoMessage()
- func (m *Node) Reset()
- func (m *Node) Size() (n int)
- func (m *Node) String() string
- func (m *Node) Unmarshal(dAtA []byte) error
- func (m *Node) XXX_DiscardUnknown()
- func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Node) XXX_Merge(src proto.Message)
- func (m *Node) XXX_Size() int
- func (m *Node) XXX_Unmarshal(b []byte) error
- type Tree
- func (t Tree) Clear()
- func (t Tree) DebugVisualize()
- func (t Tree) Decrease(key []byte, amt osmomath.Int)
- func (t Tree) Get(key []byte) osmomath.Int
- func (t Tree) Increase(key []byte, amt osmomath.Int)
- func (t Tree) IsEmpty() bool
- func (t Tree) Iterator(begin, end []byte) store.Iterator
- func (t Tree) PrefixSum(key []byte) osmomath.Int
- func (t Tree) Remove(key []byte)
- func (t Tree) ReverseIterator(begin, end []byte) store.Iterator
- func (t Tree) Set(key []byte, acc osmomath.Int)
- func (t Tree) SplitAcc(key []byte) (osmomath.Int, osmomath.Int, osmomath.Int)
- func (t Tree) SubsetAccumulation(start []byte, end []byte) osmomath.Int
- func (t Tree) TotalAccumulatedValue() osmomath.Int
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Child ¶
type Child struct { Index []byte `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` Accumulation cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=accumulation,proto3,customtype=cosmossdk.io/math.Int" json:"accumulation"` }
func (*Child) Descriptor ¶
func (*Child) ProtoMessage ¶
func (*Child) ProtoMessage()
func (*Child) XXX_DiscardUnknown ¶
func (m *Child) XXX_DiscardUnknown()
func (*Child) XXX_Marshal ¶
func (*Child) XXX_Unmarshal ¶
type Leaf ¶
type Leaf struct {
Leaf *Child `protobuf:"bytes,1,opt,name=leaf,proto3" json:"leaf,omitempty"`
}
func (*Leaf) Descriptor ¶
func (*Leaf) ProtoMessage ¶
func (*Leaf) ProtoMessage()
func (*Leaf) XXX_DiscardUnknown ¶
func (m *Leaf) XXX_DiscardUnknown()
func (*Leaf) XXX_Unmarshal ¶
type Node ¶
type Node struct {
Children []*Child `protobuf:"bytes,1,rep,name=children,proto3" json:"children,omitempty"`
}
func (*Node) Descriptor ¶
func (*Node) GetChildren ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
func (*Node) XXX_DiscardUnknown ¶
func (m *Node) XXX_DiscardUnknown()
func (*Node) XXX_Unmarshal ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is an augmented B+ tree implementation. Branches have m sized key index slice. Each key index represents the starting index of the child node's index(inclusive), and the ending index of the previous node of the child node's index(exclusive). TODO: We should abstract out the leaves of this tree to allow more data aside from the accumulation value to go there.
func (Tree) DebugVisualize ¶
func (t Tree) DebugVisualize()
DebugVisualize prints the entire tree to stdout.
func (Tree) PrefixSum ¶
Prefix sum returns the total weight of all leaves with keys <= to the provided key.
func (Tree) SubsetAccumulation ¶
SubsetAccumulation returns the total value of all leaves with keys between start and end (inclusive of both ends) if start is nil, it is the beginning of the tree. if end is nil, it is the end of the tree.
func (Tree) TotalAccumulatedValue ¶
TotalAccumulatedValue returns the sum of the weights for all leaves.