Documentation ¶
Overview ¶
Package docker implements the Scheduler interface backed by the Docker API.
Index ¶
- Constants
- type AttachedScheduler
- type Scheduler
- func (s *Scheduler) Instances(ctx context.Context, app string) ([]*twelvefactor.Task, error)
- func (s *Scheduler) InstancesFromAttachedRuns(ctx context.Context, app string) ([]*twelvefactor.Task, error)
- func (s *Scheduler) Run(ctx context.Context, app *twelvefactor.Manifest) error
- func (s *Scheduler) Stop(ctx context.Context, containerID string) error
Constants ¶
const ( Attached = "attached" Detached = "detached" )
Values for `runLabel`.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachedScheduler ¶
type AttachedScheduler struct { // If set, attached run instances will be merged in with instances // returned from the wrapped scheduler. This is currently an // experimental feature, since it requires that multiple Empire // processes interact with a single Docker daemon. ShowAttached bool twelvefactor.Scheduler // contains filtered or unexported fields }
AttachedScheduler wraps a Scheduler to run attached processes using the Docker scheduler.
func RunAttachedWithDocker ¶
func RunAttachedWithDocker(s twelvefactor.Scheduler, client *dockerutil.Client) *AttachedScheduler
RunAttachedWithDocker wraps a Scheduler to run attached Run's using a Docker client.
func (*AttachedScheduler) Run ¶
func (s *AttachedScheduler) Run(ctx context.Context, app *twelvefactor.Manifest) error
Run runs attached processes using the docker scheduler, and detached processes using the wrapped scheduler.
func (*AttachedScheduler) Stop ¶
func (s *AttachedScheduler) Stop(ctx context.Context, maybeContainerID string) error
Stop checks if there's an attached run matching the given id, and stops that container if there is. Otherwise, it delegates to the wrapped Scheduler.
func (*AttachedScheduler) Tasks ¶ added in v0.13.0
func (s *AttachedScheduler) Tasks(ctx context.Context, app string) ([]*twelvefactor.Task, error)
Tasks returns a combination of instances from the wrapped scheduler, as well as instances from attached runs.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler provides an implementation of the scheduler.Scheduler interface backed by Docker.
func NewScheduler ¶
func NewScheduler(client *dockerutil.Client) *Scheduler
NewScheduler returns a new Scheduler instance that uses the given client to interact with Docker.
func (*Scheduler) InstancesFromAttachedRuns ¶
func (s *Scheduler) InstancesFromAttachedRuns(ctx context.Context, app string) ([]*twelvefactor.Task, error)
InstancesFromAttachedRuns returns Instances that were started from attached runs.