pqueue

package
v0.0.0-...-33e4414 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHeap

func NewHeap[T any](compareFunc LessFunc[T], data []T) *baseHeap[T]

Types

type DelayQueue

type DelayQueue[T Delayer] interface {
	Offer(item T)
	ExpiredCh() <-chan T
	Len() int
	Start()
	Stop()
}

func NewDelayQueue

func NewDelayQueue[T Delayer](nowFunc func() int64, size int) DelayQueue[T]

type Delayer

type Delayer interface {
	SetExpiration(d int64) bool
	Expiration() int64
}

type LessFunc

type LessFunc[T any] func(i, j T) bool

type PriorityQueue

type PriorityQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewPriorityQueue

func NewPriorityQueue[T any](f LessFunc[T], size int, data ...T) *PriorityQueue[T]

func (*PriorityQueue[T]) Init

func (pq *PriorityQueue[T]) Init() *PriorityQueue[T]

func (*PriorityQueue[T]) Len

func (pq *PriorityQueue[T]) Len() int

func (*PriorityQueue[T]) Peek

func (pq *PriorityQueue[T]) Peek() T

func (*PriorityQueue[T]) Pop

func (pq *PriorityQueue[T]) Pop() T

func (*PriorityQueue[T]) Push

func (pq *PriorityQueue[T]) Push(item T)

Jump to

Keyboard shortcuts

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