Documentation ¶
Index ¶
- type Supervisor
- func (r *Supervisor) Cancel(taskID string)
- func (r *Supervisor) CancelAll()
- func (r *Supervisor) ClearServiceHistory(serviceID string)
- func (r *Supervisor) DelayStart(ctx context.Context, _ store.Tx, oldTask *api.Task, newTaskID string, ...) <-chan struct{}
- func (r *Supervisor) Restart(ctx context.Context, tx store.Tx, cluster *api.Cluster, service *api.Service, ...) error
- func (r *Supervisor) StartNow(tx store.Tx, taskID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Supervisor ¶
Supervisor initiates and manages restarts. It's responsible for delaying restarts when applicable.
func NewSupervisor ¶
func NewSupervisor(store *store.MemoryStore) *Supervisor
NewSupervisor creates a new RestartSupervisor.
func (*Supervisor) Cancel ¶
func (r *Supervisor) Cancel(taskID string)
Cancel cancels a pending restart.
func (*Supervisor) CancelAll ¶
func (r *Supervisor) CancelAll()
CancelAll aborts all pending restarts and waits for any instances of StartNow that have already triggered to complete.
func (*Supervisor) ClearServiceHistory ¶
func (r *Supervisor) ClearServiceHistory(serviceID string)
ClearServiceHistory forgets restart history related to a given service ID.
func (*Supervisor) DelayStart ¶
func (r *Supervisor) DelayStart(ctx context.Context, _ store.Tx, oldTask *api.Task, newTaskID string, delay time.Duration, waitStop bool) <-chan struct{}
DelayStart starts a timer that moves the task from READY to RUNNING once: - The restart delay has elapsed (if applicable) - The old task that it's replacing has stopped running (or this times out) It must be called during an Update transaction to ensure that it does not miss events. The purpose of the store.Tx argument is to avoid accidental calls outside an Update transaction.