Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
TestInstances = []string{"ct-gce-001", "ct-gce-002"}
)
Functions ¶
This section is empty.
Types ¶
type Autoscaler ¶
type Autoscaler struct {
// contains filtered or unexported fields
}
Autoscaler is a struct used for autoscaling instances in GCE.
func NewAutoscaler ¶
func NewAutoscaler(projectId, zone, workdir string, minInstanceNum, maxInstanceNum int, getInstance func(int) *gce.Instance) (*Autoscaler, error)
NewAutoscaler returns an Autoscaler instance.
func (*Autoscaler) GetNamesOfManagedInstances ¶
func (a *Autoscaler) GetNamesOfManagedInstances() []string
GetNamesOfManagedInstances returns names of all instances managed by this autoscaler.
func (*Autoscaler) GetRunningInstances ¶
func (a *Autoscaler) GetRunningInstances() ([]string, error)
GetRunningInstances returns a slice of all running instance names.
func (*Autoscaler) StartAllInstances ¶
func (a *Autoscaler) StartAllInstances() error
StartAllInstances starts all instances. Note: This method returns when all instances are in RUNNING state. Does not check to see if they are ready (ssh-able).
func (*Autoscaler) StopAllInstances ¶
func (a *Autoscaler) StopAllInstances() error
StopAllInstances stops all instances.
type IAutoscaler ¶
type IAutoscaler interface { GetRunningInstances() ([]string, error) GetNamesOfManagedInstances() []string StopAllInstances() error StartAllInstances() error }
Interface useful for mocking.
type MockAutoscaler ¶
func (*MockAutoscaler) GetNamesOfManagedInstances ¶
func (m *MockAutoscaler) GetNamesOfManagedInstances() []string
func (*MockAutoscaler) GetRunningInstances ¶
func (m *MockAutoscaler) GetRunningInstances() ([]string, error)
func (*MockAutoscaler) StartAllInstances ¶
func (m *MockAutoscaler) StartAllInstances() error
func (*MockAutoscaler) StopAllInstances ¶
func (m *MockAutoscaler) StopAllInstances() error
Click to show internal directories.
Click to hide internal directories.