Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - type Option
 - type ScheduledTask
 - type ShutdownFlag
 - type TimedExecutor
 - func (t *TimedExecutor) ExecuteAfter(f func(), delay time.Duration) *ScheduledTask
 - func (t *TimedExecutor) ExecuteAt(f func(), time time.Time) *ScheduledTask
 - func (t *TimedExecutor) Shutdown(optionalShutdownFlags ...timedqueue.ShutdownFlag)
 - func (t *TimedExecutor) Size() int
 - func (t *TimedExecutor) WorkerCount() int
 
Constants ¶
const ( // CancelPendingTasks defines a shutdown flag that causes all pending tasks to be canceled. CancelPendingTasks = timedqueue.CancelPendingElements // IgnorePendingTimeouts defines a shutdown flag, that makes the queue ignore the timeouts of the remaining queued // elements. Consecutive calls to Poll will immediately return these elements. IgnorePendingTimeouts = timedqueue.IgnorePendingTimeouts // DontWaitForShutdown causes the TimedExecutor to not wait for all tasks to be executed before returning from the // Shutdown method. DontWaitForShutdown timedqueue.ShutdownFlag = 1 << 7 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(t *TimedExecutor)
Option is the type for functional options of the TimedExecutor.
func WithMaxQueueSize ¶
WithMaxQueueSize is an Option for the TimedExecutor that allows to specify a maxSize of the underlying queue.
type ShutdownFlag ¶
type ShutdownFlag = timedqueue.ShutdownFlag
ShutdownFlag defines the type of the optional shutdown flags.
type TimedExecutor ¶
type TimedExecutor struct {
	// contains filtered or unexported fields
}
    TimedExecutor defines a scheduler that executes tasks in the background at a given time. It does not spawn any additional goroutines for each task and executes the tasks sequentially (in each worker).
func New ¶
func New(workerCount int, opts ...Option) (timedExecutor *TimedExecutor)
New is the constructor for a TimedExecutor that creates a scheduler with a given number of workers that execute the scheduled tasks in parallel (whenever they become due).
func (*TimedExecutor) ExecuteAfter ¶
func (t *TimedExecutor) ExecuteAfter(f func(), delay time.Duration) *ScheduledTask
ExecuteAfter executes the given function after the given delay.
func (*TimedExecutor) ExecuteAt ¶
func (t *TimedExecutor) ExecuteAt(f func(), time time.Time) *ScheduledTask
ExecuteAt executes the given function at the given time.
func (*TimedExecutor) Shutdown ¶
func (t *TimedExecutor) Shutdown(optionalShutdownFlags ...timedqueue.ShutdownFlag)
Shutdown shuts down the TimedExecutor and waits until the executor has shutdown gracefully.
func (*TimedExecutor) Size ¶
func (t *TimedExecutor) Size() int
Size returns the amount of jobs that are currently scheduled for execution.
func (*TimedExecutor) WorkerCount ¶
func (t *TimedExecutor) WorkerCount() int
WorkerCount returns the amount of background workers that this executor uses.