Documentation
¶
Overview ¶
Package scheduler provides the core interface that Empire uses when interacting with a cluster of machines to run tasks.
Index ¶
- Variables
- func Env(app *Manifest, process *Process) map[string]string
- func Labels(app *Manifest, process *Process) map[string]string
- type CRONSchedule
- type Exposure
- type HTTP
- type HTTPS
- type Host
- type Manifest
- type Port
- type Process
- type Protocol
- type SSL
- type Schedule
- type Scheduler
- type Status
- type StatusStream
- type StatusStreamFunc
- type TCP
- type Task
Constants ¶
This section is empty.
Variables ¶
var NullStatusStream = StatusStreamFunc(func(status Status) error { return nil })
NullStatusStream a status stream that does nothing.
Functions ¶
Types ¶
type CRONSchedule ¶
type CRONSchedule string
CRONSchedule is a Schedule implementation that represents a CRON expression.
type Exposure ¶
type Exposure struct {
// External means that this process will be exposed to internet facing
// traffic, as opposed to being internal. How this is used is
// implementation specific. For ECS, this means that the attached ELB
// will be "internet-facing".
External bool
// The ports to expose and map to the container.
Ports []Port
}
Exposure controls the exposure settings for a process.
type HTTPS ¶
type HTTPS struct {
// The certificate to attach to the process.
Cert string
}
HTTPS represents an HTTPS exposure
type Manifest ¶
type Manifest struct {
// The id of the app.
AppID string
// An identifier that represents the version of this release.
Release string
// The name of the app.
Name string
// The application environment.
Env map[string]string
// The application labels.
Labels map[string]string
// Process that belong to this app.
Processes []*Process
}
type Port ¶
type Port struct {
// The port that external applications will connect to. It's
// implementation specific as to what this is used for. For example,
// with ECS, this is used as the LoadBalancerPort.
Host int
// The port within the container that the process should bind to.
Container int
// The exposure type (e.g. HTTPExposure, HTTPSExposure, TCPExposure).
Protocol Protocol
}
Port maps a host port to a container port.
type Process ¶
type Process struct {
// The type of process.
Type string
// The Image to run.
Image image.Image
// The Command to run.
Command []string
// Environment variables to set.
Env map[string]string
// Labels to set on the container.
Labels map[string]string
// The amount of RAM to allocate to this process in bytes.
Memory uint
// the --cpu-shares flag for docker.
CPUShares uint
// ulimit -u
Nproc uint
// Quantity is the desired instances of this service to run.
Quantity int
// Exposure is the level of exposure for this process.
Exposure *Exposure
// Can be used to setup a CRON schedule to run this task periodically.
Schedule Schedule
// Any ECS specific configuration.
ECS *procfile.ECS
// Input/Output streams.
Stdin io.Reader
Stdout, Stderr io.Writer
}
type Protocol ¶
type Protocol interface {
Protocol() string
}
Protocol represents a service that a process exposes, like HTTP/HTTPS/TCP or SSL.
type SSL ¶
type SSL struct {
// The certificate to attach to the process.
Cert string
}
SSL represents a secure TCP exposure
type Schedule ¶
type Schedule interface{}
Schedule represents a Schedule for scheduled tasks that run periodically.
type Scheduler ¶
type Scheduler interface {
// Run runs a process.
Run(ctx context.Context, app *Manifest) error
// Submit submits an app, creating it or updating it as necessary.
// When StatusStream is nil, Submit should return as quickly as possible,
// usually when the new version has been received, and validated. If
// StatusStream is not nil, it's recommended that the method not return until
// the deployment has fully completed.
Submit(context.Context, *Manifest, StatusStream) error
// Remove removes the App.
Remove(ctx context.Context, app string) error
// Instance lists the instances of a Process for an app.
Tasks(ctx context.Context, app string) ([]*Task, error)
// Stop stops an instance. The scheduler will automatically start a new
// instance.
Stop(ctx context.Context, instanceID string) error
// Restart restarts the processes within the App.
Restart(context.Context, string, StatusStream) error
}
Scheduler is an interface for interfacing with Services.
type Status ¶
type Status struct {
// A friendly human readable message about the status change.
Message string
}
type StatusStream ¶
type StatusStream interface {
// Publish publishes an update to the status stream
Publish(Status) error
}
StatusStream is an interface for publishing status updates while a scheduler is executing.
type StatusStreamFunc ¶
StatusStreamFunc is a function that implements the Statusstream interface
func (StatusStreamFunc) Publish ¶
func (fn StatusStreamFunc) Publish(status Status) error