Documentation
¶
Index ¶
- func StartPaused() func(disp *Dispatcher)
- type Dispatcher
- type DisplayableTask
- type Job
- func (j *Job) Cancel()
- func (j *Job) Cleanup()
- func (j *Job) CreatedAt() time.Time
- func (j *Job) Data() map[string]interface{}
- func (j *Job) Err() error
- func (j *Job) GetData(key string) interface{}
- func (j *Job) ID() uuid.UUID
- func (j *Job) LastMessage() string
- func (j *Job) LastUpdate() Update
- func (j *Job) MessageHistory() []string
- func (j *Job) SetData(key string, value interface{})
- func (j *Job) State() JobState
- func (j *Job) Task() Task
- type JobState
- type Option
- type RunContext
- type SliceJobStore
- type StateTransitionSubscriptionEvent
- type Subscription
- type SubscriptionEvent
- type Task
- type Update
- type UpdateSubscriptionEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartPaused ¶
func StartPaused() func(disp *Dispatcher)
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func New ¶
func New(options ...Option) *Dispatcher
func (*Dispatcher) ClearDone ¶
func (d *Dispatcher) ClearDone() []*Job
ClearDone removes all the jobs that are not running. The jobs that were cleaned up will be returned.
func (*Dispatcher) Close ¶
func (d *Dispatcher) Close()
Close cancels the running tasks and waits for the dispatcher to stop
func (*Dispatcher) Enqueue ¶
func (d *Dispatcher) Enqueue(task Task) *Job
Enqueue adds a new job to the wait queue. If there is something that can execute the job immediately, it will be started.
func (*Dispatcher) Job ¶
func (d *Dispatcher) Job(id uuid.UUID) *Job
Job returns the job with the given ID.
func (*Dispatcher) Subscribe ¶
func (d *Dispatcher) Subscribe() *Subscription
Subscribe starts a new subscription for job updates.
type DisplayableTask ¶
type DisplayableTask interface {
PreferredTemplate() string
}
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job is a handle to a running job
func (*Job) LastMessage ¶ added in v0.0.7
func (*Job) LastUpdate ¶
func (*Job) MessageHistory ¶ added in v0.0.7
type Option ¶
type Option func(disp *Dispatcher)
type RunContext ¶
type SliceJobStore ¶
type SliceJobStore struct {
// contains filtered or unexported fields
}
func NewSliceJobStore ¶
func NewSliceJobStore() *SliceJobStore
func (*SliceJobStore) Add ¶
func (js *SliceJobStore) Add(job *Job)
func (*SliceJobStore) ClearDone ¶
func (js *SliceJobStore) ClearDone() []*Job
func (*SliceJobStore) List ¶
func (js *SliceJobStore) List() []*Job
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) Chan ¶
func (s *Subscription) Chan() chan SubscriptionEvent
func (*Subscription) Close ¶
func (s *Subscription) Close()
type SubscriptionEvent ¶
type SubscriptionEvent interface{}
type Task ¶
type Task interface { String() string // Execute executes the task with the given context. Execute(ctx context.Context, runContext RunContext) error }
Task is something that a job is to perform
type UpdateSubscriptionEvent ¶
Click to show internal directories.
Click to hide internal directories.