Documentation ¶
Index ¶
- Variables
- type ByExpiry
- func (tree *ByExpiry) Begin() IteratorByExpiry
- func (tree *ByExpiry) Clear()
- func (tree *ByExpiry) Empty() bool
- func (tree *ByExpiry) End() IteratorByExpiry
- func (tree *ByExpiry) Erase(iter IteratorByExpiry) (itr IteratorByExpiry)
- func (tree *ByExpiry) Erases(first, last IteratorByExpiry)
- func (tree *ByExpiry) Find(key common.TimePoint) IteratorByExpiry
- func (tree *ByExpiry) Insert(v TransactionIdWithExpiry) (IteratorByExpiry, bool)
- func (tree *ByExpiry) Iterator() IteratorByExpiry
- func (tree *ByExpiry) Keys() []common.TimePoint
- func (tree *ByExpiry) Left() *ByExpiryNode
- func (tree *ByExpiry) LowerBound(key common.TimePoint) IteratorByExpiry
- func (tree *ByExpiry) Modify(iter IteratorByExpiry, mod func(*TransactionIdWithExpiry)) bool
- func (tree *ByExpiry) Remove(key common.TimePoint)
- func (tree *ByExpiry) Right() *ByExpiryNode
- func (tree *ByExpiry) Size() int
- func (tree *ByExpiry) String() string
- func (tree *ByExpiry) UpperBound(key common.TimePoint) IteratorByExpiry
- func (tree *ByExpiry) Values() []TransactionIdWithExpiry
- type ByExpiryNode
- type ById
- func (i *ById) Each(f func(key common.TransactionIdType, obj TransactionIdWithExpiry))
- func (i *ById) Empty() bool
- func (i *ById) End() IteratorById
- func (i *ById) Erase(iter IteratorById)
- func (i *ById) Find(k common.TransactionIdType) (IteratorById, bool)
- func (i *ById) GetFinalIndex() interface{}
- func (i *ById) GetSuperIndex() interface{}
- func (i *ById) Insert(v TransactionIdWithExpiry) (IteratorById, bool)
- func (i *ById) Modify(iter IteratorById, mod func(*TransactionIdWithExpiry)) bool
- func (i *ById) Size() int
- func (i *ById) Values() []TransactionIdWithExpiry
- type ByIdNode
- type IteratorByExpiry
- func (iterator *IteratorByExpiry) Begin()
- func (iterator *IteratorByExpiry) Delete()
- func (iterator *IteratorByExpiry) End()
- func (iterator IteratorByExpiry) HasNext() bool
- func (iterator *IteratorByExpiry) HasPrev() bool
- func (iterator IteratorByExpiry) IsBegin() bool
- func (iterator IteratorByExpiry) IsEnd() bool
- func (iterator IteratorByExpiry) Key() common.TimePoint
- func (iterator *IteratorByExpiry) Next() bool
- func (iterator *IteratorByExpiry) Prev() bool
- func (iterator IteratorByExpiry) Value() TransactionIdWithExpiry
- type IteratorById
- type TransactionIdWithExpiry
- type TransactionIdWithExpiryIndex
- func (m *TransactionIdWithExpiryIndex) Clear()
- func (m *TransactionIdWithExpiryIndex) Erase(iter multiindex.IteratorType)
- func (m *TransactionIdWithExpiryIndex) GetByExpiry() *ByExpiry
- func (m *TransactionIdWithExpiryIndex) GetById() *ById
- func (m *TransactionIdWithExpiryIndex) GetFinalIndex() interface{}
- func (m *TransactionIdWithExpiryIndex) GetIndex() interface{}
- func (m *TransactionIdWithExpiryIndex) GetSuperIndex() interface{}
- func (m *TransactionIdWithExpiryIndex) Insert(v TransactionIdWithExpiry) bool
- func (m *TransactionIdWithExpiryIndex) Modify(iter multiindex.IteratorType, mod func(*TransactionIdWithExpiry)) bool
- func (m *TransactionIdWithExpiryIndex) Size() int
- type TransactionIdWithExpiryIndexBase
- type TransactionIdWithExpiryIndexBaseNode
- type TransactionIdWithExpiryIndexNode
Constants ¶
This section is empty.
Variables ¶
var ByExpireCompare = func(a, b common.TimePoint) int {
switch {
case a > b:
return 1
case a < b:
return -1
default:
return 0
}
}
var ByExpiryFunc = func(n TransactionIdWithExpiry) common.TimePoint { return n.Expiry }
var ByIdFunc = func(n TransactionIdWithExpiry) common.TransactionIdType { return n.TrxId }
Functions ¶
This section is empty.
Types ¶
type ByExpiry ¶
type ByExpiry struct { Root *ByExpiryNode // contains filtered or unexported fields }
OrderedIndex holds elements of the red-black tree
func (*ByExpiry) Begin ¶
func (tree *ByExpiry) Begin() IteratorByExpiry
func (*ByExpiry) End ¶
func (tree *ByExpiry) End() IteratorByExpiry
func (*ByExpiry) Erase ¶
func (tree *ByExpiry) Erase(iter IteratorByExpiry) (itr IteratorByExpiry)
func (*ByExpiry) Erases ¶
func (tree *ByExpiry) Erases(first, last IteratorByExpiry)
func (*ByExpiry) Find ¶
func (tree *ByExpiry) Find(key common.TimePoint) IteratorByExpiry
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 (*ByExpiry) Insert ¶
func (tree *ByExpiry) Insert(v TransactionIdWithExpiry) (IteratorByExpiry, bool)
func (*ByExpiry) Iterator ¶
func (tree *ByExpiry) Iterator() IteratorByExpiry
Iterator returns a stateful iterator whose elements are key/value pairs.
func (*ByExpiry) Left ¶
func (tree *ByExpiry) Left() *ByExpiryNode
Left returns the left-most (min) node or nil if tree is empty.
func (*ByExpiry) LowerBound ¶
func (tree *ByExpiry) LowerBound(key common.TimePoint) IteratorByExpiry
LowerBound returns an iterator pointing to the first element that is not less than the given key. Complexity: O(log N).
func (*ByExpiry) Modify ¶
func (tree *ByExpiry) Modify(iter IteratorByExpiry, mod func(*TransactionIdWithExpiry)) bool
func (*ByExpiry) Remove ¶
Remove remove the node from the tree by key. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*ByExpiry) Right ¶
func (tree *ByExpiry) Right() *ByExpiryNode
Right returns the right-most (max) node or nil if tree is empty.
func (*ByExpiry) UpperBound ¶
func (tree *ByExpiry) UpperBound(key common.TimePoint) IteratorByExpiry
UpperBound returns an iterator pointing to the first element that is greater than the given key. Complexity: O(log N).
func (*ByExpiry) Values ¶
func (tree *ByExpiry) Values() []TransactionIdWithExpiry
Values returns all values in-order based on the key.
type ByExpiryNode ¶
type ByExpiryNode struct { Key common.TimePoint Left *ByExpiryNode Right *ByExpiryNode Parent *ByExpiryNode // contains filtered or unexported fields }
OrderedIndexNode is a single element within the tree
func (*ByExpiryNode) String ¶
func (node *ByExpiryNode) String() string
type ById ¶
type ById struct {
// contains filtered or unexported fields
}
func (*ById) Each ¶
func (i *ById) Each(f func(key common.TransactionIdType, obj TransactionIdWithExpiry))
func (*ById) End ¶
func (i *ById) End() IteratorById
func (*ById) Erase ¶
func (i *ById) Erase(iter IteratorById)
func (*ById) Find ¶
func (i *ById) Find(k common.TransactionIdType) (IteratorById, bool)
func (*ById) GetFinalIndex ¶
func (i *ById) GetFinalIndex() interface{}
func (*ById) GetSuperIndex ¶
func (i *ById) GetSuperIndex() interface{}
func (*ById) Insert ¶
func (i *ById) Insert(v TransactionIdWithExpiry) (IteratorById, bool)
func (*ById) Modify ¶
func (i *ById) Modify(iter IteratorById, mod func(*TransactionIdWithExpiry)) bool
func (*ById) Values ¶
func (i *ById) Values() []TransactionIdWithExpiry
type ByIdNode ¶
type ByIdNode struct {
// contains filtered or unexported fields
}
func (*ByIdNode) GetFinalNode ¶
func (n *ByIdNode) GetFinalNode() interface{}
func (*ByIdNode) GetSuperNode ¶
func (n *ByIdNode) GetSuperNode() interface{}
type IteratorByExpiry ¶
type IteratorByExpiry struct {
// contains filtered or unexported fields
}
Iterator holding the iterator's state
func (*IteratorByExpiry) Begin ¶
func (iterator *IteratorByExpiry) Begin()
Begin resets the iterator to its initial state (one-before-first) Call Next() to fetch the first element if any.
func (*IteratorByExpiry) Delete ¶
func (iterator *IteratorByExpiry) Delete()
Delete remove the node which pointed by the iterator Modifies the state of the iterator.
func (*IteratorByExpiry) End ¶
func (iterator *IteratorByExpiry) End()
End moves the iterator past the last element (one-past-the-end). Call Prev() to fetch the last element if any.
func (IteratorByExpiry) HasNext ¶
func (iterator IteratorByExpiry) HasNext() bool
func (*IteratorByExpiry) HasPrev ¶
func (iterator *IteratorByExpiry) HasPrev() bool
func (IteratorByExpiry) IsBegin ¶
func (iterator IteratorByExpiry) IsBegin() bool
func (IteratorByExpiry) IsEnd ¶
func (iterator IteratorByExpiry) IsEnd() bool
func (IteratorByExpiry) Key ¶
func (iterator IteratorByExpiry) Key() common.TimePoint
Key returns the current element's key. Does not modify the state of the iterator.
func (*IteratorByExpiry) Next ¶
func (iterator *IteratorByExpiry) 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 (*IteratorByExpiry) Prev ¶
func (iterator *IteratorByExpiry) 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 (IteratorByExpiry) Value ¶
func (iterator IteratorByExpiry) Value() TransactionIdWithExpiry
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
}
func (IteratorById) HasNext ¶
func (iter IteratorById) HasNext() bool
func (IteratorById) IsEnd ¶
func (iter IteratorById) IsEnd() bool
func (IteratorById) Value ¶
func (iter IteratorById) Value() (v TransactionIdWithExpiry)
type TransactionIdWithExpiry ¶
type TransactionIdWithExpiry struct { TrxId common.TransactionIdType Expiry common.TimePoint }
type TransactionIdWithExpiryIndex ¶
type TransactionIdWithExpiryIndex struct {
// contains filtered or unexported fields
}
func NewTransactionIdWithExpiryIndex ¶
func NewTransactionIdWithExpiryIndex() *TransactionIdWithExpiryIndex
func (*TransactionIdWithExpiryIndex) Clear ¶
func (m *TransactionIdWithExpiryIndex) Clear()
func (*TransactionIdWithExpiryIndex) Erase ¶
func (m *TransactionIdWithExpiryIndex) Erase(iter multiindex.IteratorType)
func (*TransactionIdWithExpiryIndex) GetByExpiry ¶
func (m *TransactionIdWithExpiryIndex) GetByExpiry() *ByExpiry
func (*TransactionIdWithExpiryIndex) GetById ¶
func (m *TransactionIdWithExpiryIndex) GetById() *ById
func (*TransactionIdWithExpiryIndex) GetFinalIndex ¶
func (m *TransactionIdWithExpiryIndex) GetFinalIndex() interface{}
func (*TransactionIdWithExpiryIndex) GetIndex ¶
func (m *TransactionIdWithExpiryIndex) GetIndex() interface{}
func (*TransactionIdWithExpiryIndex) GetSuperIndex ¶
func (m *TransactionIdWithExpiryIndex) GetSuperIndex() interface{}
method for MultiIndex
func (*TransactionIdWithExpiryIndex) Insert ¶
func (m *TransactionIdWithExpiryIndex) Insert(v TransactionIdWithExpiry) bool
func (*TransactionIdWithExpiryIndex) Modify ¶
func (m *TransactionIdWithExpiryIndex) Modify(iter multiindex.IteratorType, mod func(*TransactionIdWithExpiry)) bool
func (*TransactionIdWithExpiryIndex) Size ¶
func (m *TransactionIdWithExpiryIndex) Size() int
type TransactionIdWithExpiryIndexBase ¶
type TransactionIdWithExpiryIndexBase struct {
// contains filtered or unexported fields
}
/ IndexBase
func (*TransactionIdWithExpiryIndexBase) GetFinalIndex ¶
func (i *TransactionIdWithExpiryIndexBase) GetFinalIndex() interface{}
func (*TransactionIdWithExpiryIndexBase) GetSuperIndex ¶
func (i *TransactionIdWithExpiryIndexBase) GetSuperIndex() interface{}
type TransactionIdWithExpiryIndexBaseNode ¶
type TransactionIdWithExpiryIndexBaseNode struct {
// contains filtered or unexported fields
}
type TransactionIdWithExpiryIndexNode ¶
type TransactionIdWithExpiryIndexNode struct {
// contains filtered or unexported fields
}
func (*TransactionIdWithExpiryIndexNode) GetFinalNode ¶
func (n *TransactionIdWithExpiryIndexNode) GetFinalNode() interface{}
func (*TransactionIdWithExpiryIndexNode) GetSuperNode ¶
func (n *TransactionIdWithExpiryIndexNode) GetSuperNode() interface{}