Documentation ¶
Overview ¶
Package scaley provides the domain objects, interfaces, and workflows for scaling server groups on Engine Yard Cloud.
Index ¶
- func Finalize(result dry.Result) error
- func Scale() *dry.Transaction
- type CannotLoadGroup
- type ChefFailure
- type Direction
- type Environment
- type EnvironmentService
- type ExecService
- type Group
- type GroupIsLocked
- type GroupService
- type InvalidEnvironment
- type InvalidScalingServer
- type LockFailure
- type LockService
- type LogService
- type MissingScalingScript
- type NoChangeRequired
- type NoViableCandidates
- type ScalingEvent
- type ScalingFailure
- type ScalingScriptService
- type Server
- type ServerService
- type Services
- type Severity
- type Strategy
- type UnlockFailure
- type UnspecifiedScalingScript
- type UnspecifiedScalingServers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Finalize ¶
Finalize is the last step of all scaley runs. It takes a dry.Result with an embedded scaling event and handles things like cleanup, logging of event completion, and so on. If the scaling event failed, an error is returned. Otherwise, nil is returned.
func Scale ¶
func Scale() *dry.Transaction
Scale is a factory that produces a new Transaction that can be called with Call.
Types ¶
type CannotLoadGroup ¶
CannotLoadGroup is an error that is raised when the group data cannot be read from its data source.
func (CannotLoadGroup) Error ¶
func (e CannotLoadGroup) Error() string
type ChefFailure ¶
type ChefFailure struct { Group *Group Environment *Environment }
ChefFailure is an error that is raised when an attempt to reconfigure an environment fails.
func (ChefFailure) Error ¶
func (e ChefFailure) Error() string
type Direction ¶
type Direction int
Direction describes the desired direction (up, down, none) for a scaling event.
func (Direction) DesiredState ¶
DesiredState returns the state that a server should be in for scaling to be considered for a given direction.
type Environment ¶
Environment is a representation of an Engine Yard Cloud environment.
type EnvironmentService ¶
type EnvironmentService interface { Get(string) (*Environment, error) Configure(*Environment) error }
EnvironmentService is an interface that describes an object that knows how to interact with an Environment.
type ExecService ¶
ExecService is an interface that describes an object that knows how to execute external commands.
type Group ¶
type Group struct { Name string `yaml:"name"` ScalingServers []string `yaml:"scaling_servers"` ScalingScript string `yaml:"scaling_script"` StopScript string `yaml:"stop_script"` IgnoreStopScriptErrors bool `yaml:"ignore_stop_script_errors"` Strategy string `yaml:"strategy"` }
Group is a representation of a scaling group.
type GroupIsLocked ¶
type GroupIsLocked struct {
Group *Group
}
GroupIsLocked is an error that is raised when the group associated with a scaling event is already locked for scaling operations.
func (GroupIsLocked) Error ¶
func (e GroupIsLocked) Error() string
type GroupService ¶
GroupService is an interface that describes an object that knows how to interact with a Group.
type InvalidEnvironment ¶
type InvalidEnvironment struct {
Group *Group
}
InvalidEnvironment is an error that is raised when the environment associated with a scaling script's group cannot be loaded from the Engine Yard API.
func (InvalidEnvironment) Error ¶
func (e InvalidEnvironment) Error() string
type InvalidScalingServer ¶
InvalidScalingServer is an error that is raised when a group contains a scaling server that cannot be found on the upstream Engine Yard API.
func (InvalidScalingServer) Error ¶
func (e InvalidScalingServer) Error() string
type LockFailure ¶
type LockFailure struct {
Group *Group
}
LockFailure is an error that is raised when an attempt to lock a group fails.
func (LockFailure) Error ¶
func (e LockFailure) Error() string
type LockService ¶
LockService is an interface that describes an object that knows how to deal with Group locking.
type LogService ¶
LogService is an interface that describes an object that provides logging capabilities.
type MissingScalingScript ¶
type MissingScalingScript struct {
Group *Group
}
MissingScalingScript is an error that is raised when a group's configured scaling script does not actually exist.
func (MissingScalingScript) Error ¶
func (e MissingScalingScript) Error() string
type NoChangeRequired ¶
type NoChangeRequired struct{}
NoChangeRequired is an error that is raised when the scaling script for a scaling script's group indicates that the group should not be scaled.
func (NoChangeRequired) Error ¶
func (e NoChangeRequired) Error() string
type NoViableCandidates ¶
NoViableCandidates is an error that is raised when there are no servers in the desired state for the associated scaling event.
func (NoViableCandidates) Error ¶
func (e NoViableCandidates) Error() string
type ScalingEvent ¶
type ScalingEvent struct { GroupName string Services *Services Group *Group Strategy Strategy Direction Direction Servers []*Server Environment *Environment Candidates []*Server Scaled []*Server Failed []*Server Error error }
ScalingEvent is a collection of data that acts as both input and output to a Scale transaction.
type ScalingFailure ¶
ScalingFailure is an error that is raised when an attempt to scale a group's scaling servers up or down fails.
func (ScalingFailure) Error ¶
func (e ScalingFailure) Error() string
type ScalingScriptService ¶
ScalingScriptService is an interface that describes an object that knows how to interct with a ScalingScript.
type Server ¶
type Server struct { ID int ProvisionedID string State string Hostname string EnvironmentID string }
Server is a representation of a server in an Engine Yard Cloud environment.
type ServerService ¶
type ServerService interface { Get(string) (*Server, error) Start(*Server) error Stop(*Server) error }
ServerService is an interface that describes an object that knows how to interact with a Server.
type Services ¶
type Services struct { Groups GroupService Servers ServerService Environments EnvironmentService Scripts ScalingScriptService Locker LockService Runner ExecService Log LogService }
Services is a handy collection of the various services one uses to perform tasks within Scaley.
type Strategy ¶
type Strategy int
Strategy describes one of several possible scaling strategies for a group.
func CalculateStrategy ¶
CalculateStrategy takes a group and returns the strategy with which it is configured. If the group lacks a strategy, Legion is returned by default.
type UnlockFailure ¶
type UnlockFailure struct {
Group *Group
}
UnlockFailure is an error that is raised when an attempt to unlock a group fails.
func (UnlockFailure) Error ¶
func (e UnlockFailure) Error() string
type UnspecifiedScalingScript ¶
type UnspecifiedScalingScript struct {
Group *Group
}
UnspecifiedScalingScript is an error that is raised when a group does not have a scaling script configured.
func (UnspecifiedScalingScript) Error ¶
func (e UnspecifiedScalingScript) Error() string
type UnspecifiedScalingServers ¶
type UnspecifiedScalingServers struct {
Group *Group
}
UnspecifiedScalingServers is an error that is raised when a group has no scaling servers configured.
func (UnspecifiedScalingServers) Error ¶
func (e UnspecifiedScalingServers) Error() string