memory

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateWeight added in v0.6.0

func CalculateWeight(maxUnacked int, unacked int, queueSize int) int

CalculateWeight calculates the weight for a group based on unacked items and queue size.

Types

type DelayedQueue added in v0.6.0

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

func NewDelayedQueue added in v0.6.0

func NewDelayedQueue(minFirst bool) *DelayedQueue

func (*DelayedQueue) Delete added in v0.6.0

func (pq *DelayedQueue) Delete(group string, id uint64) *Item

func (*DelayedQueue) Dequeue added in v0.6.0

func (pq *DelayedQueue) Dequeue(ack bool) *Item

func (*DelayedQueue) Enqueue added in v0.6.0

func (pq *DelayedQueue) Enqueue(group string, item *Item)

func (*DelayedQueue) Get added in v0.6.0

func (pq *DelayedQueue) Get(group string, id uint64) *Item

func (*DelayedQueue) Len added in v0.6.0

func (pq *DelayedQueue) Len() uint64

func (*DelayedQueue) UpdatePriority added in v0.6.0

func (pq *DelayedQueue) UpdatePriority(group string, id uint64, priority int64)

func (*DelayedQueue) UpdateWeights added in v0.6.0

func (pq *DelayedQueue) UpdateWeights(group string, id uint64) error

type FairRoundRobinQueue added in v0.6.0

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

FairRoundRobinQueue is a fair queue that balances between different groups

func NewFairRoundRobinQueue added in v0.6.0

func NewFairRoundRobinQueue(maxUnacked int) *FairRoundRobinQueue

FairQueue creates a new FairQueue

func (*FairRoundRobinQueue) Delete added in v0.6.0

func (fq *FairRoundRobinQueue) Delete(group string, id uint64) *Item

func (*FairRoundRobinQueue) Dequeue added in v0.6.0

func (fq *FairRoundRobinQueue) Dequeue(ack bool) *Item

Dequeue removes and returns the next message in a fair way

func (*FairRoundRobinQueue) Enqueue added in v0.6.0

func (fq *FairRoundRobinQueue) Enqueue(group string, item *Item)

Enqueue adds a message to the queue

func (*FairRoundRobinQueue) Get added in v0.6.0

func (fq *FairRoundRobinQueue) Get(group string, id uint64) *Item

func (*FairRoundRobinQueue) Len added in v0.6.0

func (fq *FairRoundRobinQueue) Len() uint64

func (*FairRoundRobinQueue) UpdatePriority added in v0.6.0

func (fq *FairRoundRobinQueue) UpdatePriority(group string, id uint64, priority int64)

func (*FairRoundRobinQueue) UpdateWeights added in v0.6.0

func (fq *FairRoundRobinQueue) UpdateWeights(group string, id uint64) error

type FairWeightedQueue added in v0.6.0

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

func NewFairWeightedQueue added in v0.6.0

func NewFairWeightedQueue(maxUnacked int) *FairWeightedQueue

func (*FairWeightedQueue) Delete added in v0.6.0

func (q *FairWeightedQueue) Delete(group string, id uint64) *Item

func (*FairWeightedQueue) Dequeue added in v0.6.0

func (q *FairWeightedQueue) Dequeue(ack bool) *Item

func (*FairWeightedQueue) Enqueue added in v0.6.0

func (q *FairWeightedQueue) Enqueue(group string, item *Item)

func (*FairWeightedQueue) Get added in v0.6.0

func (q *FairWeightedQueue) Get(group string, id uint64) *Item

func (*FairWeightedQueue) Len added in v0.6.0

func (q *FairWeightedQueue) Len() uint64

func (*FairWeightedQueue) UpdatePriority added in v0.6.0

func (q *FairWeightedQueue) UpdatePriority(group string, id uint64, priority int64)

func (*FairWeightedQueue) UpdateWeights added in v0.6.0

func (q *FairWeightedQueue) UpdateWeights(group string, id uint64) error

type Item

type Item struct {
	ID       uint64
	Priority int64
	Group    string
}

func (*Item) UpdatePriority

func (m *Item) UpdatePriority(newPriority int64)

type LinkedList

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

func (*LinkedList) Append

func (l *LinkedList) Append(node *LinkedListNode)

func (*LinkedList) Len

func (l *LinkedList) Len() uint64

func (*LinkedList) Remove

func (l *LinkedList) Remove(node *LinkedListNode)

type LinkedListNode

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

func NewLinkedListNode

func NewLinkedListNode(group string, queue *PriorityMemoryQueue) *LinkedListNode

func (*LinkedListNode) Queue

func (n *LinkedListNode) Queue() *PriorityMemoryQueue

type MemoryQueue

type MemoryQueue interface {
	Enqueue(group string, item *Item)
	Dequeue(ack bool) *Item
	Get(group string, id uint64) *Item
	Delete(group string, id uint64) *Item
	UpdatePriority(group string, id uint64, priority int64)
	Len() uint64
	UpdateWeights(group string, id uint64) error
}

type PriorityMemoryQueue

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

func NewPriorityMemoryQueue

func NewPriorityMemoryQueue(minFirst bool) *PriorityMemoryQueue

func (*PriorityMemoryQueue) Delete

func (pq *PriorityMemoryQueue) Delete(id uint64) *Item

func (*PriorityMemoryQueue) Get

func (pq *PriorityMemoryQueue) Get(id uint64) *Item

func (PriorityMemoryQueue) Len

func (pq PriorityMemoryQueue) Len() int

func (PriorityMemoryQueue) Less

func (pq PriorityMemoryQueue) Less(i, j int) bool

func (*PriorityMemoryQueue) Peek

func (pq *PriorityMemoryQueue) Peek() any

func (*PriorityMemoryQueue) Pop

func (pq *PriorityMemoryQueue) Pop() any

func (*PriorityMemoryQueue) Push

func (pq *PriorityMemoryQueue) Push(x any)

func (PriorityMemoryQueue) Swap

func (pq PriorityMemoryQueue) Swap(i, j int)

func (*PriorityMemoryQueue) UpdatePriority

func (pq *PriorityMemoryQueue) UpdatePriority(id uint64, priority int64)

Jump to

Keyboard shortcuts

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