priorityqueue

package
v2.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 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 BinHeap

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

func NewBinHeap

func NewBinHeap(maxLen uint64) *BinHeap

func (*BinHeap) ExtractMin

func (bh *BinHeap) ExtractMin() Item

func (*BinHeap) Insert

func (bh *BinHeap) Insert(item Item)

func (*BinHeap) Len

func (bh *BinHeap) Len() uint64

type Item

type Item interface {
	// ID is a unique item identifier
	ID() string

	// Priority returns the Item's priority to sort
	Priority() int64

	// Body is the Item payload
	Body() []byte

	// Context is the Item meta information
	Context() ([]byte, error)

	// Ack - acknowledge the Item after processing
	Ack() error

	// Nack - discard the Item
	Nack() error

	// Requeue - put the message back to the queue with the optional delay
	Requeue(headers map[string][]string, delay int64) error
}

Item represents binary heap item

type Queue

type Queue interface {
	Insert(item Item)
	ExtractMin() Item
	Len() uint64
}

Jump to

Keyboard shortcuts

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