priorityqueue

package
v1.9.11 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityLow    = 0
	PriorityMedium = 1
	PriorityHigh   = 2
)

Priority levels

Variables

View Source
var (
	LDAPQueue     = NewLDAPRequestQueue()
	LDAPAuthQueue = NewLDAPAuthRequestQueue()
	LuaQueue      = NewLuaRequestQueue()
)

Global queue instances

Functions

This section is empty.

Types

type LDAPAuthRequestItem

type LDAPAuthRequestItem struct {
	Request    *bktype.LDAPAuthRequest
	Priority   int
	InsertTime time.Time
	Index      int // Used by heap.Interface
}

LDAPAuthRequestItem represents an item in the LDAP auth request priority queue

type LDAPAuthRequestPriorityQueue

type LDAPAuthRequestPriorityQueue []*LDAPAuthRequestItem

LDAPAuthRequestPriorityQueue implements heap.Interface and holds LDAPAuthRequestItems

func (*LDAPAuthRequestPriorityQueue) Len

Len returns the number of items in the LDAPAuthRequestPriorityQueue.

func (*LDAPAuthRequestPriorityQueue) Less

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

Less determines the order of items in the LDAPAuthRequestPriorityQueue based on priority and insertion time.

func (*LDAPAuthRequestPriorityQueue) Pop

Pop removes and returns the last item from the LDAPAuthRequestPriorityQueue, adjusting indices to maintain consistency.

func (*LDAPAuthRequestPriorityQueue) Push

func (pq *LDAPAuthRequestPriorityQueue) Push(x any)

Push adds a new LDAPAuthRequestItem to the LDAPAuthRequestPriorityQueue and assigns its index.

func (*LDAPAuthRequestPriorityQueue) Swap

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

Swap exchanges the elements at indices i and j in the LDAPAuthRequestPriorityQueue and updates their indices.

type LDAPAuthRequestQueue

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

LDAPAuthRequestQueue manages a priority queue for LDAP auth requests

func NewLDAPAuthRequestQueue

func NewLDAPAuthRequestQueue() *LDAPAuthRequestQueue

NewLDAPAuthRequestQueue creates a new LDAPAuthRequestQueue

func (*LDAPAuthRequestQueue) AddPoolName

func (q *LDAPAuthRequestQueue) AddPoolName(poolName string)

AddPoolName adds a pool name to the LDAPAuthRequestQueue

func (*LDAPAuthRequestQueue) GetPoolNames

func (q *LDAPAuthRequestQueue) GetPoolNames() []string

GetPoolNames returns the pool names in the LDAPAuthRequestQueue

func (*LDAPAuthRequestQueue) Pop

Pop removes and returns the highest priority request from the LDAPAuthRequestQueue It blocks if the queue is empty

func (*LDAPAuthRequestQueue) Push

func (q *LDAPAuthRequestQueue) Push(request *bktype.LDAPAuthRequest, priority int)

Push adds a request to the LDAPAuthRequestQueue with the given priority

type LDAPRequestItem

type LDAPRequestItem struct {
	Request    *bktype.LDAPRequest
	Priority   int
	InsertTime time.Time
	Index      int // Used by heap.Interface
}

LDAPRequestItem represents an item in the LDAP request priority queue

type LDAPRequestPriorityQueue

type LDAPRequestPriorityQueue []*LDAPRequestItem

LDAPRequestPriorityQueue implements heap.Interface and holds LDAPRequestItems

func (*LDAPRequestPriorityQueue) Len

func (pq *LDAPRequestPriorityQueue) Len() int

Len returns the number of items currently stored in the LDAPRequestPriorityQueue.

func (*LDAPRequestPriorityQueue) Less

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

Less determines the order of items in the priority queue by comparing their Priority and InsertTime fields.

func (*LDAPRequestPriorityQueue) Pop

func (pq *LDAPRequestPriorityQueue) Pop() any

Pop removes and returns the highest-priority item from the LDAPRequestPriorityQueue, updating its Index field for safety.

func (*LDAPRequestPriorityQueue) Push

func (pq *LDAPRequestPriorityQueue) Push(x any)

Push adds a new LDAPRequestItem to the LDAPRequestPriorityQueue and sets its index to the next available position.

func (*LDAPRequestPriorityQueue) Swap

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

Swap exchanges the elements at indices i and j in the LDAPRequestPriorityQueue, updating their Index fields accordingly.

type LDAPRequestQueue

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

LDAPRequestQueue manages a priority queue for LDAP requests

func NewLDAPRequestQueue

func NewLDAPRequestQueue() *LDAPRequestQueue

NewLDAPRequestQueue creates a new LDAPRequestQueue

func (*LDAPRequestQueue) AddPoolName

func (q *LDAPRequestQueue) AddPoolName(poolName string)

AddPoolName adds a pool name to the LDAPRequestQueue

func (*LDAPRequestQueue) GetPoolNames

func (q *LDAPRequestQueue) GetPoolNames() []string

GetPoolNames returns the pool names in the LDAPRequestQueue

func (*LDAPRequestQueue) Pop

Pop removes and returns the highest priority request from the LDAPRequestQueue It blocks if the queue is empty

func (*LDAPRequestQueue) Push

func (q *LDAPRequestQueue) Push(request *bktype.LDAPRequest, priority int)

Push adds a request to the LDAPRequestQueue with the given priority

type LuaRequestItem

type LuaRequestItem struct {
	Request    *bktype.LuaRequest
	Priority   int
	InsertTime time.Time
	Index      int // Used by heap.Interface
}

LuaRequestItem represents an item in the Lua request priority queue

type LuaRequestPriorityQueue

type LuaRequestPriorityQueue []*LuaRequestItem

LuaRequestPriorityQueue implements heap.Interface and holds LuaRequestItems

func (*LuaRequestPriorityQueue) Len

func (pq *LuaRequestPriorityQueue) Len() int

Len returns the number of elements in the LuaRequestPriorityQueue.

func (*LuaRequestPriorityQueue) Less

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

Less determines the order of elements in the LuaRequestPriorityQueue based on priority and insertion time. Returns true if the element at index i should sort before the element at index j.

func (*LuaRequestPriorityQueue) Pop

func (pq *LuaRequestPriorityQueue) Pop() any

Pop removes and returns the last element from the priority queue. It also resets the item's Index field for safety.

func (*LuaRequestPriorityQueue) Push

func (pq *LuaRequestPriorityQueue) Push(x any)

Push adds a new LuaRequestItem to the LuaRequestPriorityQueue and assigns its index based on the current queue size.

func (*LuaRequestPriorityQueue) Swap

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

Swap swaps the elements with indexes i and j in the LuaRequestPriorityQueue and updates their respective Index fields.

type LuaRequestQueue

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

LuaRequestQueue manages a priority queue for Lua requests

func NewLuaRequestQueue

func NewLuaRequestQueue() *LuaRequestQueue

NewLuaRequestQueue creates a new LuaRequestQueue

func (*LuaRequestQueue) AddBackendName

func (q *LuaRequestQueue) AddBackendName(backendName string)

AddBackendName adds a backend name to the LuaRequestQueue

func (*LuaRequestQueue) GetBackendNames

func (q *LuaRequestQueue) GetBackendNames() []string

GetBackendNames returns the backend names in the LuaRequestQueue

func (*LuaRequestQueue) Pop

func (q *LuaRequestQueue) Pop() *bktype.LuaRequest

Pop removes and returns the highest priority request from the LuaRequestQueue It blocks if the queue is empty

func (*LuaRequestQueue) Push

func (q *LuaRequestQueue) Push(request *bktype.LuaRequest, priority int)

Push adds a request to the LuaRequestQueue with the given priority

Jump to

Keyboard shortcuts

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