Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoundedMemoryChain ¶
type BoundedMemoryChain struct {
// contains filtered or unexported fields
}
func NewBoundedMemoryChain ¶
func NewBoundedMemoryChain( maxNodes uint32) *BoundedMemoryChain
NewBoundedMemoryChain returns a new instance of the BoundedMemoryChain with a target max number of nodes.
func (*BoundedMemoryChain) Back ¶
func (b *BoundedMemoryChain) Back() *Node
Back returns the end of the chain. If the chain is empty, then this return a pointer to a nil node.
NOTE: Part of the Chain interface.
func (*BoundedMemoryChain) Front ¶
func (b *BoundedMemoryChain) Front() *Node
Front returns the head of the chain. If the chain is empty, then this returns a pointer to a nil node.
NOTE: Part of the Chain interface.
func (*BoundedMemoryChain) PushBack ¶
func (b *BoundedMemoryChain) PushBack(n Node) *Node
PushBack will push a new entry to the end of the chain. The entry added to the chain is also returned in place. As the chain is bounded, if the length of the chain is exceeded, then the front of the chain will be walked forward one element.
NOTE: Part of the Chain interface.
func (*BoundedMemoryChain) ResetHeaderState ¶
func (b *BoundedMemoryChain) ResetHeaderState(n Node)
ResetHeaderState resets the state of all nodes. After this method, it will be as if the chain was just newly created.
NOTE: Part of the Chain interface.
type Node ¶
type Node struct { // Height is the height of this node within the main chain. Height int32 // Header is the header that this node represents. Header wire.BlockHeader // contains filtered or unexported fields }