Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blockify ¶
type Blockify interface { flow.Entity Height() uint64 ParentID() flow.Identifier }
Blockify becuase Blocker seems a bit off. Make items behave like a block, so it can be queued
type Queue ¶
type Queue struct { Head *Node Highest *Node Nodes map[flow.Identifier]*Node }
Queue is a fork-aware queue/tree of blocks for use in execution Node, where parallel forks can be processed simultaneously. For fast lookup which is predicted to be common case all nodes are kept as one queue, which is expected to split into separate queues once a fork (multiple children) is reached. Note that this is not a thread-safe structure and external synchronisation is required to use in concurrent environment
func (*Queue) Attach ¶
Attach joins the other queue to this one, modifying this queue in-place. Other queue be attached if only if the following conditions hold:
- The head of other has a parent in this queue.
- Both queues have no nodes in common. Specifically, this means that the head of _other_ cannot be a member of this queue.
Fails otherwise with an error. CAUTION: failing with an error leaves this queue in a _dysfunctional_ (partially joined) state.
func (*Queue) Checksum ¶
func (q *Queue) Checksum() flow.Identifier
func (*Queue) Dismount ¶
Dismount removes the head element, returns it and it's children as new queues
func (*Queue) Height ¶
Returns difference between lowest and highest element in the queue Formally, the Queue stores a tree. The height of the tree is the number of edges on the longest downward path between the root and any leaf.
func (*Queue) ID ¶
func (q *Queue) ID() flow.Identifier
func (*Queue) TryAdd ¶
TryAdd tries to add a new element to the queue. A element can only be added if the parent exists in the queue. TryAdd(elmt) is an idempotent operation for the same elmt, i.e. after the first, subsequent additions of the same elements are NoOps. Returns: stored = True if and only if _after_ the operation, the element is stored in the queue. This is the case if (a) element was newly added to the queue or (b) element was already stored in the queue _before_ the call. new = Indicates if element was new to the queue, when `stored` was true. It lets distinguish (a) and (b) cases. Adding an element fails with return value `false` for `stored` in the following cases:
- element.ParentID() is _not_ stored in the queue
- element's height is _unequal to_ its parent's height + 1