priority_queue

package
v0.0.0-...-aefcfe0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	// Value represents any value
	Value interface{}
	// Priority represents priority of the signing reqeust
	Priority Priority
}

Item is used to push to and pop value with priority

type LenAll

type LenAll struct {
	Low    int `json:"low"`
	Medium int `json:"medium"`
	High   int `json:"high"`
}

LenAll represents lengths of priority channels

type Priority

type Priority int

Priority of signing request

const (
	// UnknownPriority represents an Unknown Priority signing request
	UnknownPriority Priority = iota
	// LowPriority represents an Low Priority signing request
	LowPriority
	// MediumPriority represents an Medium Priority signing request
	MediumPriority
	// HighPriority represents an High Priority signing request
	HighPriority
)

func (Priority) String

func (i Priority) String() string

type PriorityQueue

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

PriorityQueue represents priority channels

func New

func New(size int) *PriorityQueue

func (*PriorityQueue) Len

func (q *PriorityQueue) Len(p Priority) (int, error)

Len returns length of the channel by priority

func (*PriorityQueue) LenAll

func (q *PriorityQueue) LenAll() LenAll

LenAll returns lengths of all priority channels

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() Item

Pop returns appropriate item from the priority queue

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(i Item)

Push adds an item to the priority queue

Jump to

Keyboard shortcuts

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