Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultMaxBackoff is the default maximum backoff duration for workers. DefaultMaxBackoff = 1 * time.Second // DefaultMinBackoff is the default minimum backoff duration for workers. DefaultMinBackoff = 100 * time.Millisecond // DefaultNumWorkers is the default number of workers in the scheduler. DefaultNumWorkers = 4 // DefaultMaxRetries is the default maximum number of retries for dequeue operations. DefaultMaxRetries = 5 )
View Source
const (
// DefaultMaxSizePerTenant is the default maximum number of items per tenant in the queue.
DefaultMaxSizePerTenant = 100
)
Variables ¶
View Source
var ErrMissingTenantID = errors.New("item requires TenantID")
View Source
var ErrNilRunnable = errors.New("cannot enqueue nil runnable")
View Source
var ErrQueueClosed = errors.New("queue closed")
View Source
var ErrTenantQueueFull = errors.New("tenant queue full")
Functions ¶
This section is empty.
Types ¶
type Queue ¶
Queue implements a multi-tenant qos with round-robin fairness using a dispatcher goroutine.
func NewQueue ¶
func NewQueue(opts *QueueOptions) *Queue
NewQueue creates a new Queue and starts its dispatcher goroutine.
func (*Queue) ActiveTenantsLen ¶
ActiveTenantsLen returns the number of tenants with items currently in the queue.
func (*Queue) Dequeue ¶
Dequeue removes and returns a work item from the qos using linked-list round-robin. It blocks until an item is available for any tenant, the queue is closed, or the context is cancelled.
type QueueOptions ¶
type QueueOptions struct {
MaxSizePerTenant int
Registerer prometheus.Registerer
Logger log.Logger
}
Click to show internal directories.
Click to hide internal directories.