node_transaction

package
v0.0.0-...-8f1dc17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ByBlockNumCompare = container.UInt32Comparator
View Source
var ByBlockNumFunc = func(n multi_index.NodeTransactionState) uint32 { return n.BlockNum }
View Source
var ByExpiryCompare = func(a, b common.TimePointSec) int { return container.UInt32Comparator(uint32(a), uint32(b)) }
View Source
var ByExpiryFunc = func(n multi_index.NodeTransactionState) common.TimePointSec { return n.Expires }
View Source
var ByIdCompare = crypto.Sha256Compare
View Source
var ByIdFunc = func(n multi_index.NodeTransactionState) common.TransactionIdType { 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) Clear

func (tree *ByBlockNum) Clear()

Clear removes all nodes from the tree.

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 (*ByBlockNum) Iterator

func (tree *ByBlockNum) Iterator() IteratorByBlockNum

Iterator returns a stateful iterator whose elements are key/value pairs.

func (*ByBlockNum) Keys

func (tree *ByBlockNum) Keys() []uint32

Keys returns all keys in-order

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.NodeTransactionState)) 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.NodeTransactionState

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 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) Clear

func (tree *ByExpiry) Clear()

Clear removes all nodes from the tree.

func (*ByExpiry) Empty

func (tree *ByExpiry) Empty() bool

Empty returns true if tree does not contain any nodes

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.TimePointSec) 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 (*ByExpiry) Iterator

func (tree *ByExpiry) Iterator() IteratorByExpiry

Iterator returns a stateful iterator whose elements are key/value pairs.

func (*ByExpiry) Keys

func (tree *ByExpiry) Keys() []common.TimePointSec

Keys returns all keys in-order

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.TimePointSec) 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(*multi_index.NodeTransactionState)) bool

func (*ByExpiry) Remove

func (tree *ByExpiry) Remove(key common.TimePointSec)

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) Size

func (tree *ByExpiry) Size() int

Size returns number of nodes in the tree.

func (*ByExpiry) String

func (tree *ByExpiry) String() string

String returns a string representation of container

func (*ByExpiry) UpperBound

func (tree *ByExpiry) UpperBound(key common.TimePointSec) 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() []multi_index.NodeTransactionState

Values returns all values in-order based on the key.

type ByExpiryNode

type ByExpiryNode struct {
	Key common.TimePointSec

	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 {
	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) Clear

func (tree *ById) Clear()

Clear removes all nodes from the tree.

func (*ById) Empty

func (tree *ById) Empty() bool

Empty returns true if tree does not contain any nodes

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.TransactionIdType) 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 (*ById) Iterator

func (tree *ById) Iterator() IteratorById

Iterator returns a stateful iterator whose elements are key/value pairs.

func (*ById) Keys

func (tree *ById) Keys() []common.TransactionIdType

Keys returns all keys in-order

func (*ById) Left

func (tree *ById) Left() *ByIdNode

Left returns the left-most (min) node or nil if tree is empty.

func (*ById) LowerBound

func (tree *ById) LowerBound(key common.TransactionIdType) 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.NodeTransactionState)) bool

func (*ById) Remove

func (tree *ById) Remove(key common.TransactionIdType)

Remove remove the node from the tree by key. Key should adhere to the comparator's type assertion, otherwise method panics.

func (*ById) Right

func (tree *ById) Right() *ByIdNode

Right returns the right-most (max) node or nil if tree is empty.

func (*ById) Size

func (tree *ById) Size() int

Size returns number of nodes in the tree.

func (*ById) String

func (tree *ById) String() string

String returns a string representation of container

func (*ById) UpperBound

func (tree *ById) UpperBound(key common.TransactionIdType) 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.NodeTransactionState

Values returns all values in-order based on the key.

type ByIdNode

type ByIdNode struct {
	Key common.TransactionIdType

	Left   *ByIdNode
	Right  *ByIdNode
	Parent *ByIdNode
	// contains filtered or unexported fields
}

OrderedIndexNode is a single element within the tree

func (*ByIdNode) String

func (node *ByIdNode) String() string

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

Value returns the current element's value. Does not modify the state of the iterator.

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.TimePointSec

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

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.TransactionIdType

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

Value returns the current element's value. Does not modify the state of the iterator.

type NodeTransactionIndex

type NodeTransactionIndex struct {
	// contains filtered or unexported fields
}

func NewNodeTransactionIndex

func NewNodeTransactionIndex() *NodeTransactionIndex

func (*NodeTransactionIndex) Clear

func (m *NodeTransactionIndex) Clear()

func (*NodeTransactionIndex) Erase

func (*NodeTransactionIndex) GetByBlockNum

func (m *NodeTransactionIndex) GetByBlockNum() *ByBlockNum

func (*NodeTransactionIndex) GetByExpiry

func (m *NodeTransactionIndex) GetByExpiry() *ByExpiry

func (*NodeTransactionIndex) GetById

func (m *NodeTransactionIndex) GetById() *ById

func (*NodeTransactionIndex) GetFinalIndex

func (m *NodeTransactionIndex) GetFinalIndex() interface{}

func (*NodeTransactionIndex) GetIndex

func (m *NodeTransactionIndex) GetIndex() interface{}

func (*NodeTransactionIndex) GetSuperIndex

func (m *NodeTransactionIndex) GetSuperIndex() interface{}

method for MultiIndex

func (*NodeTransactionIndex) Insert

func (*NodeTransactionIndex) Modify

func (*NodeTransactionIndex) Size

func (m *NodeTransactionIndex) Size() int

type NodeTransactionIndexBase

type NodeTransactionIndexBase struct {
	// contains filtered or unexported fields
}

/ IndexBase

func (*NodeTransactionIndexBase) GetFinalIndex

func (i *NodeTransactionIndexBase) GetFinalIndex() interface{}

func (*NodeTransactionIndexBase) GetSuperIndex

func (i *NodeTransactionIndexBase) GetSuperIndex() interface{}

type NodeTransactionIndexBaseNode

type NodeTransactionIndexBaseNode struct {
	// contains filtered or unexported fields
}

type NodeTransactionIndexNode

type NodeTransactionIndexNode struct {
	// contains filtered or unexported fields
}

func (*NodeTransactionIndexNode) GetFinalNode

func (n *NodeTransactionIndexNode) GetFinalNode() interface{}

func (*NodeTransactionIndexNode) GetSuperNode

func (n *NodeTransactionIndexNode) GetSuperNode() interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL