queue

package
v0.0.0-...-6a013f7 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WeightQueue

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

WeightQueue implements a weighted priority queue. In a high load regime, the network connection would be saturated and transactions with higher MWM (minimum weight magnitude) would rise to the top of the priority queue, so if you want your translation to propagate faster in the network you would apply more PoW, hence setting priority based on MWM.

func NewWeightQueue

func NewWeightQueue(maxLen int) *WeightQueue

NewWeightQueue creates a new weighted queue. Items in the queue are ordered by weight (heaviest first).

func (*WeightQueue) Pop

func (q *WeightQueue) Pop() interface{}

Pop pops an item from the queue. If no item is present the call blocks until a new item was pushed.

func (*WeightQueue) Push

func (q *WeightQueue) Push(value interface{}, weight int) bool

Push pushes a new weighted value to the queue. If the queue is full, this call blocks until the queue drops below its own max length.

Jump to

Keyboard shortcuts

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