2018-07-13 20:45:57 +00:00
|
|
|
package interfaces
|
|
|
|
|
2018-07-16 21:37:27 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
)
|
2018-07-13 20:45:57 +00:00
|
|
|
|
|
|
|
type TaskLifecycle interface {
|
2018-11-05 20:20:45 +00:00
|
|
|
// Restart a task in place. If failure=false then the restart does not
|
|
|
|
// count as an attempt in the restart policy.
|
2018-07-16 21:37:27 +00:00
|
|
|
Restart(ctx context.Context, event *structs.TaskEvent, failure bool) error
|
2018-11-05 20:20:45 +00:00
|
|
|
|
|
|
|
// Sends a signal to a task.
|
2018-10-04 19:08:20 +00:00
|
|
|
Signal(event *structs.TaskEvent, signal string) error
|
2018-11-05 20:20:45 +00:00
|
|
|
|
|
|
|
// Kill a task permanently.
|
2018-07-16 21:37:27 +00:00
|
|
|
Kill(ctx context.Context, event *structs.TaskEvent) error
|
2018-07-13 20:45:57 +00:00
|
|
|
}
|