pqueue

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROCESSING ItemStatus = "in progress"
	INVOKED    ItemStatus = "invoked"

	HighPriority   = 10
	NormalPriority = 5
	LowPriority    = 0
)

Variables

This section is empty.

Functions

func CtxPQueues

func CtxPQueues(entry interface{}, ctx context.Context) context.Context

Types

type ItemStatus

type ItemStatus string

type PQueues

type PQueues struct {
	SuperUserPQueue *PriorityQueue
	UserPQueue      *PriorityQueue
}

func NewPQueues

func NewPQueues() PQueues

func PQueuesInstance

func PQueuesInstance(ctx context.Context) *PQueues

type PriorityQueue

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

func (*PriorityQueue) FixIndexesInPQueue

func (pq *PriorityQueue) FixIndexesInPQueue()

func (*PriorityQueue) Len

func (pq *PriorityQueue) Len() int

func (*PriorityQueue) Less

func (pq *PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) ProcessQueue

func (pq *PriorityQueue) ProcessQueue(requestLimit int64, timeLimit time.Duration, stop chan struct{})

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (*PriorityQueue) RemoveById

func (pq *PriorityQueue) RemoveById(id string) error

func (*PriorityQueue) Swap

func (pq *PriorityQueue) Swap(i, j int)

func (*PriorityQueue) WaitUntilInvoked

func (pq *PriorityQueue) WaitUntilInvoked(id string) (*QueueItem, error)

type PriorityQueueInterface

type PriorityQueueInterface interface {
	WaitUntilInvoked(id string) (*QueueItem, error)
	ProcessQueue(requestLimit int64, timeLimit time.Duration, stop chan struct{})
}

func NewPriorityQueue

func NewPriorityQueue() PriorityQueueInterface

type QueueItem

type QueueItem struct {
	Id string

	Func     interface{}
	Args     []interface{}
	Response Response

	Priority int
	Amount   int
	// contains filtered or unexported fields
}

type Response

type Response struct {
	Value interface{}
	Error error
}

Jump to

Keyboard shortcuts

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