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.