Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageHeap ¶
type MessageHeap[T any] struct { // contains filtered or unexported fields }
MessageHeap implements the container/heap interface to hold messages
func NewMessageHeap ¶
func NewMessageHeap[T any](size int) *MessageHeap[T]
NewMessageHeap returns an initialized MessageHeap of the specified size
func (*MessageHeap[T]) Less ¶
func (h *MessageHeap[T]) Less(i, j int) bool
Less returns which item in the heap is smaller than the other
type PriorityQueue ¶
type PriorityQueue[T any] struct { // contains filtered or unexported fields }
PriorityQueue is like a channel but with dynamic buffering and returns items with the highest priority first
func NewPriorityQueue ¶
func NewPriorityQueue[T any](queueSize int) *PriorityQueue[T]
NewPriorityQueue returns a PriorityQueue instance that is ready to send to
func (*PriorityQueue[T]) Recv ¶
func (pq *PriorityQueue[T]) Recv(fn func(*Message[T]))
Recv takes a function that can receive messages sent to the queue
func (*PriorityQueue[T]) Send ¶
func (pq *PriorityQueue[T]) Send(msg *Message[T])
Send puts items on the queue
Click to show internal directories.
Click to hide internal directories.