restart

package
v0.0.0-...-be68371 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Supervisor

type Supervisor struct {
	TaskTimeout time.Duration
	// contains filtered or unexported fields
}

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.

func (*Supervisor) Restart

func (r *Supervisor) Restart(ctx context.Context, tx store.Tx, cluster *api.Cluster, service *api.Service, t api.Task) error

Restart initiates a new task to replace t if appropriate under the service's restart policy.

func (*Supervisor) StartNow

func (r *Supervisor) StartNow(tx store.Tx, taskID string) error

StartNow moves the task into the RUNNING state so it will proceed to start up.

Jump to

Keyboard shortcuts

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