Documentation ¶
Index ¶
- Variables
- type ByBlockNum
- func (tree *ByBlockNum) Begin() IteratorByBlockNum
- func (tree *ByBlockNum) Clear()
- func (tree *ByBlockNum) Empty() bool
- func (tree *ByBlockNum) End() IteratorByBlockNum
- func (tree *ByBlockNum) Erase(iter IteratorByBlockNum) (itr IteratorByBlockNum)
- func (tree *ByBlockNum) Erases(first, last IteratorByBlockNum)
- func (tree *ByBlockNum) Find(key uint32) IteratorByBlockNum
- func (tree *ByBlockNum) Insert(v multi_index.PeerBlockState) (IteratorByBlockNum, bool)
- func (tree *ByBlockNum) Iterator() IteratorByBlockNum
- func (tree *ByBlockNum) Keys() []uint32
- func (tree *ByBlockNum) Left() *ByBlockNumNode
- func (tree *ByBlockNum) LowerBound(key uint32) IteratorByBlockNum
- func (tree *ByBlockNum) Modify(iter IteratorByBlockNum, mod func(*multi_index.PeerBlockState)) bool
- func (tree *ByBlockNum) Remove(key uint32)
- func (tree *ByBlockNum) Right() *ByBlockNumNode
- func (tree *ByBlockNum) Size() int
- func (tree *ByBlockNum) String() string
- func (tree *ByBlockNum) UpperBound(key uint32) IteratorByBlockNum
- func (tree *ByBlockNum) Values() []multi_index.PeerBlockState
- type ByBlockNumNode
- type ById
- func (tree *ById) Begin() IteratorById
- func (tree *ById) Clear()
- func (tree *ById) Empty() bool
- func (tree *ById) End() IteratorById
- func (tree *ById) Erase(iter IteratorById) (itr IteratorById)
- func (tree *ById) Erases(first, last IteratorById)
- func (tree *ById) Find(key common.BlockIdType) IteratorById
- func (tree *ById) Insert(v multi_index.PeerBlockState) (IteratorById, bool)
- func (tree *ById) Iterator() IteratorById
- func (tree *ById) Keys() []common.BlockIdType
- func (tree *ById) Left() *ByIdNode
- func (tree *ById) LowerBound(key common.BlockIdType) IteratorById
- func (tree *ById) Modify(iter IteratorById, mod func(*multi_index.PeerBlockState)) bool
- func (tree *ById) Remove(key common.BlockIdType)
- func (tree *ById) Right() *ByIdNode
- func (tree *ById) Size() int
- func (tree *ById) String() string
- func (tree *ById) UpperBound(key common.BlockIdType) IteratorById
- func (tree *ById) Values() []multi_index.PeerBlockState
- type ByIdNode
- type IteratorByBlockNum
- func (iterator *IteratorByBlockNum) Begin()
- func (iterator *IteratorByBlockNum) Delete()
- func (iterator *IteratorByBlockNum) End()
- func (iterator IteratorByBlockNum) HasNext() bool
- func (iterator *IteratorByBlockNum) HasPrev() bool
- func (iterator IteratorByBlockNum) IsBegin() bool
- func (iterator IteratorByBlockNum) IsEnd() bool
- func (iterator IteratorByBlockNum) Key() uint32
- func (iterator *IteratorByBlockNum) Next() bool
- func (iterator *IteratorByBlockNum) Prev() bool
- func (iterator IteratorByBlockNum) Value() multi_index.PeerBlockState
- type IteratorById
- func (iterator *IteratorById) Begin()
- func (iterator *IteratorById) Delete()
- func (iterator *IteratorById) End()
- func (iterator IteratorById) HasNext() bool
- func (iterator *IteratorById) HasPrev() bool
- func (iterator IteratorById) IsBegin() bool
- func (iterator IteratorById) IsEnd() bool
- func (iterator IteratorById) Key() common.BlockIdType
- func (iterator *IteratorById) Next() bool
- func (iterator *IteratorById) Prev() bool
- func (iterator IteratorById) Value() multi_index.PeerBlockState
- type PeerBlockStateIndex
- func (m *PeerBlockStateIndex) Clear()
- func (m *PeerBlockStateIndex) Erase(iter multiindex.IteratorType)
- func (m *PeerBlockStateIndex) GetByBlockNum() *ByBlockNum
- func (m *PeerBlockStateIndex) GetById() *ById
- func (m *PeerBlockStateIndex) GetFinalIndex() interface{}
- func (m *PeerBlockStateIndex) GetIndex() interface{}
- func (m *PeerBlockStateIndex) GetSuperIndex() interface{}
- func (m *PeerBlockStateIndex) Insert(v multi_index.PeerBlockState) bool
- func (m *PeerBlockStateIndex) Modify(iter multiindex.IteratorType, mod func(*multi_index.PeerBlockState)) bool
- func (m *PeerBlockStateIndex) Size() int
- type PeerBlockStateIndexBase
- type PeerBlockStateIndexBaseNode
- type PeerBlockStateIndexNode
Constants ¶
This section is empty.
Variables ¶
var ByBlockNumCompare = container.UInt32Comparator
var ByBlockNumFunc = func(n multi_index.PeerBlockState) uint32 { return n.BlockNum }
var ByIdCompare = crypto.Sha256Compare
var ByIdFunc = func(n multi_index.PeerBlockState) common.BlockIdType { return n.ID }
Functions ¶
This section is empty.
Types ¶
type ByBlockNum ¶
type ByBlockNum struct { Root *ByBlockNumNode // contains filtered or unexported fields }
OrderedIndex holds elements of the red-black tree
func (*ByBlockNum) Begin ¶
func (tree *ByBlockNum) Begin() IteratorByBlockNum
func (*ByBlockNum) Empty ¶
func (tree *ByBlockNum) Empty() bool
Empty returns true if tree does not contain any nodes
func (*ByBlockNum) End ¶
func (tree *ByBlockNum) End() IteratorByBlockNum
func (*ByBlockNum) Erase ¶
func (tree *ByBlockNum) Erase(iter IteratorByBlockNum) (itr IteratorByBlockNum)
func (*ByBlockNum) Erases ¶
func (tree *ByBlockNum) Erases(first, last IteratorByBlockNum)
func (*ByBlockNum) Find ¶
func (tree *ByBlockNum) Find(key uint32) IteratorByBlockNum
Get searches the node in the tree by key and returns its value or nil if key is not found in tree. Second return parameter is true if key was found, otherwise false. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*ByBlockNum) Insert ¶
func (tree *ByBlockNum) Insert(v multi_index.PeerBlockState) (IteratorByBlockNum, bool)
func (*ByBlockNum) Iterator ¶
func (tree *ByBlockNum) Iterator() IteratorByBlockNum
Iterator returns a stateful iterator whose elements are key/value pairs.
func (*ByBlockNum) Left ¶
func (tree *ByBlockNum) Left() *ByBlockNumNode
Left returns the left-most (min) node or nil if tree is empty.
func (*ByBlockNum) LowerBound ¶
func (tree *ByBlockNum) LowerBound(key uint32) IteratorByBlockNum
LowerBound returns an iterator pointing to the first element that is not less than the given key. Complexity: O(log N).
func (*ByBlockNum) Modify ¶
func (tree *ByBlockNum) Modify(iter IteratorByBlockNum, mod func(*multi_index.PeerBlockState)) bool
func (*ByBlockNum) Remove ¶
func (tree *ByBlockNum) Remove(key uint32)
Remove remove the node from the tree by key. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*ByBlockNum) Right ¶
func (tree *ByBlockNum) Right() *ByBlockNumNode
Right returns the right-most (max) node or nil if tree is empty.
func (*ByBlockNum) Size ¶
func (tree *ByBlockNum) Size() int
Size returns number of nodes in the tree.
func (*ByBlockNum) String ¶
func (tree *ByBlockNum) String() string
String returns a string representation of container
func (*ByBlockNum) UpperBound ¶
func (tree *ByBlockNum) UpperBound(key uint32) IteratorByBlockNum
UpperBound returns an iterator pointing to the first element that is greater than the given key. Complexity: O(log N).
func (*ByBlockNum) Values ¶
func (tree *ByBlockNum) Values() []multi_index.PeerBlockState
Values returns all values in-order based on the key.
type ByBlockNumNode ¶
type ByBlockNumNode struct { Key uint32 Left *ByBlockNumNode Right *ByBlockNumNode Parent *ByBlockNumNode // contains filtered or unexported fields }
OrderedIndexNode is a single element within the tree
func (*ByBlockNumNode) String ¶
func (node *ByBlockNumNode) String() string
type ById ¶
type ById struct { Root *ByIdNode // contains filtered or unexported fields }
OrderedIndex holds elements of the red-black tree
func (*ById) Begin ¶
func (tree *ById) Begin() IteratorById
func (*ById) End ¶
func (tree *ById) End() IteratorById
func (*ById) Erase ¶
func (tree *ById) Erase(iter IteratorById) (itr IteratorById)
func (*ById) Erases ¶
func (tree *ById) Erases(first, last IteratorById)
func (*ById) Find ¶
func (tree *ById) Find(key common.BlockIdType) IteratorById
Get searches the node in the tree by key and returns its value or nil if key is not found in tree. Second return parameter is true if key was found, otherwise false. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*ById) Insert ¶
func (tree *ById) Insert(v multi_index.PeerBlockState) (IteratorById, bool)
func (*ById) Iterator ¶
func (tree *ById) Iterator() IteratorById
Iterator returns a stateful iterator whose elements are key/value pairs.
func (*ById) LowerBound ¶
func (tree *ById) LowerBound(key common.BlockIdType) IteratorById
LowerBound returns an iterator pointing to the first element that is not less than the given key. Complexity: O(log N).
func (*ById) Modify ¶
func (tree *ById) Modify(iter IteratorById, mod func(*multi_index.PeerBlockState)) bool
func (*ById) Remove ¶
func (tree *ById) Remove(key common.BlockIdType)
Remove remove the node from the tree by key. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*ById) UpperBound ¶
func (tree *ById) UpperBound(key common.BlockIdType) IteratorById
UpperBound returns an iterator pointing to the first element that is greater than the given key. Complexity: O(log N).
func (*ById) Values ¶
func (tree *ById) Values() []multi_index.PeerBlockState
Values returns all values in-order based on the key.
type ByIdNode ¶
type ByIdNode struct { Key common.BlockIdType Left *ByIdNode Right *ByIdNode Parent *ByIdNode // contains filtered or unexported fields }
OrderedIndexNode is a single element within the tree
type IteratorByBlockNum ¶
type IteratorByBlockNum struct {
// contains filtered or unexported fields
}
Iterator holding the iterator's state
func (*IteratorByBlockNum) Begin ¶
func (iterator *IteratorByBlockNum) Begin()
Begin resets the iterator to its initial state (one-before-first) Call Next() to fetch the first element if any.
func (*IteratorByBlockNum) Delete ¶
func (iterator *IteratorByBlockNum) Delete()
Delete remove the node which pointed by the iterator Modifies the state of the iterator.
func (*IteratorByBlockNum) End ¶
func (iterator *IteratorByBlockNum) End()
End moves the iterator past the last element (one-past-the-end). Call Prev() to fetch the last element if any.
func (IteratorByBlockNum) HasNext ¶
func (iterator IteratorByBlockNum) HasNext() bool
func (*IteratorByBlockNum) HasPrev ¶
func (iterator *IteratorByBlockNum) HasPrev() bool
func (IteratorByBlockNum) IsBegin ¶
func (iterator IteratorByBlockNum) IsBegin() bool
func (IteratorByBlockNum) IsEnd ¶
func (iterator IteratorByBlockNum) IsEnd() bool
func (IteratorByBlockNum) Key ¶
func (iterator IteratorByBlockNum) Key() uint32
Key returns the current element's key. Does not modify the state of the iterator.
func (*IteratorByBlockNum) Next ¶
func (iterator *IteratorByBlockNum) Next() bool
Next moves the iterator to the next element and returns true if there was a next element in the container. If Next() returns true, then next element's key and value can be retrieved by Key() and Value(). If Next() was called for the first time, then it will point the iterator to the first element if it exists. Modifies the state of the iterator.
func (*IteratorByBlockNum) Prev ¶
func (iterator *IteratorByBlockNum) Prev() bool
Prev moves the iterator to the previous element and returns true if there was a previous element in the container. If Prev() returns true, then previous element's key and value can be retrieved by Key() and Value(). Modifies the state of the iterator.
func (IteratorByBlockNum) Value ¶
func (iterator IteratorByBlockNum) Value() multi_index.PeerBlockState
Value returns the current element's value. Does not modify the state of the iterator.
type IteratorById ¶
type IteratorById struct {
// contains filtered or unexported fields
}
Iterator holding the iterator's state
func (*IteratorById) Begin ¶
func (iterator *IteratorById) Begin()
Begin resets the iterator to its initial state (one-before-first) Call Next() to fetch the first element if any.
func (*IteratorById) Delete ¶
func (iterator *IteratorById) Delete()
Delete remove the node which pointed by the iterator Modifies the state of the iterator.
func (*IteratorById) End ¶
func (iterator *IteratorById) End()
End moves the iterator past the last element (one-past-the-end). Call Prev() to fetch the last element if any.
func (IteratorById) HasNext ¶
func (iterator IteratorById) HasNext() bool
func (*IteratorById) HasPrev ¶
func (iterator *IteratorById) HasPrev() bool
func (IteratorById) IsBegin ¶
func (iterator IteratorById) IsBegin() bool
func (IteratorById) IsEnd ¶
func (iterator IteratorById) IsEnd() bool
func (IteratorById) Key ¶
func (iterator IteratorById) Key() common.BlockIdType
Key returns the current element's key. Does not modify the state of the iterator.
func (*IteratorById) Next ¶
func (iterator *IteratorById) Next() bool
Next moves the iterator to the next element and returns true if there was a next element in the container. If Next() returns true, then next element's key and value can be retrieved by Key() and Value(). If Next() was called for the first time, then it will point the iterator to the first element if it exists. Modifies the state of the iterator.
func (*IteratorById) Prev ¶
func (iterator *IteratorById) Prev() bool
Prev moves the iterator to the previous element and returns true if there was a previous element in the container. If Prev() returns true, then previous element's key and value can be retrieved by Key() and Value(). Modifies the state of the iterator.
func (IteratorById) Value ¶
func (iterator IteratorById) Value() multi_index.PeerBlockState
Value returns the current element's value. Does not modify the state of the iterator.
type PeerBlockStateIndex ¶
type PeerBlockStateIndex struct {
// contains filtered or unexported fields
}
func NewPeerBlockStateIndex ¶
func NewPeerBlockStateIndex() *PeerBlockStateIndex
func (*PeerBlockStateIndex) Clear ¶
func (m *PeerBlockStateIndex) Clear()
func (*PeerBlockStateIndex) Erase ¶
func (m *PeerBlockStateIndex) Erase(iter multiindex.IteratorType)
func (*PeerBlockStateIndex) GetByBlockNum ¶
func (m *PeerBlockStateIndex) GetByBlockNum() *ByBlockNum
func (*PeerBlockStateIndex) GetById ¶
func (m *PeerBlockStateIndex) GetById() *ById
func (*PeerBlockStateIndex) GetFinalIndex ¶
func (m *PeerBlockStateIndex) GetFinalIndex() interface{}
func (*PeerBlockStateIndex) GetIndex ¶
func (m *PeerBlockStateIndex) GetIndex() interface{}
func (*PeerBlockStateIndex) GetSuperIndex ¶
func (m *PeerBlockStateIndex) GetSuperIndex() interface{}
method for MultiIndex
func (*PeerBlockStateIndex) Insert ¶
func (m *PeerBlockStateIndex) Insert(v multi_index.PeerBlockState) bool
func (*PeerBlockStateIndex) Modify ¶
func (m *PeerBlockStateIndex) Modify(iter multiindex.IteratorType, mod func(*multi_index.PeerBlockState)) bool
func (*PeerBlockStateIndex) Size ¶
func (m *PeerBlockStateIndex) Size() int
type PeerBlockStateIndexBase ¶
type PeerBlockStateIndexBase struct {
// contains filtered or unexported fields
}
/ IndexBase
func (*PeerBlockStateIndexBase) GetFinalIndex ¶
func (i *PeerBlockStateIndexBase) GetFinalIndex() interface{}
func (*PeerBlockStateIndexBase) GetSuperIndex ¶
func (i *PeerBlockStateIndexBase) GetSuperIndex() interface{}
type PeerBlockStateIndexBaseNode ¶
type PeerBlockStateIndexBaseNode struct {
// contains filtered or unexported fields
}
type PeerBlockStateIndexNode ¶
type PeerBlockStateIndexNode struct {
// contains filtered or unexported fields
}
func (*PeerBlockStateIndexNode) GetFinalNode ¶
func (n *PeerBlockStateIndexNode) GetFinalNode() interface{}
func (*PeerBlockStateIndexNode) GetSuperNode ¶
func (n *PeerBlockStateIndexNode) GetSuperNode() interface{}