Documentation
¶
Index ¶
Constants ¶
View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)
Go does not provide a MaxInt, so we have to calculate it.
Variables ¶
This section is empty.
Functions ¶
func NewAutoScaler ¶
func NewAutoScaler(metricsReceiver metrics.MetricsReceiver, transportInspector transport.Inspector) *autoScaler
NewAutoScaler constructs an autoscaler instance using the given metrics receiver and the given transport inspector.
Types ¶
type AutoScaler ¶
type AutoScaler interface {
// Set maximum replica count policy.
SetMaxReplicasPolicy(func(function FunctionId) int)
// Set delay scale down policy.
SetDelayScaleDownPolicy(func(function FunctionId) time.Duration)
// Run starts the autoscaler receiving and sampling metrics.
Run()
// Close stops the autoscaler receiving and sampling metrics.
io.Closer
// InformFunctionReplicas is used to tell the autoscaler the actual number of replicas there are for a given
// function. The function is not necessarily being monitored by the autoscaler.
InformFunctionReplicas(function FunctionId, replicas int)
// StartMonitoring starts monitoring metrics for the given topic and function.
StartMonitoring(topic string, function FunctionId) error
// StopMonitoring stops monitoring metrics for the given topic and function.
StopMonitoring(topic string, function FunctionId) error
// Propose proposes the number of replicas for functions that are being monitored.
Propose() map[FunctionId]int
}
type Delayer ¶
type Delayer struct {
// contains filtered or unexported fields
}
func NewDelayer ¶
NewDelayer creates a delayer which delays scaling down to zero until the delay returned by the given policy has elapsed.
type FunctionId ¶
type FunctionId struct {
Function string
}
FunctionId identifies a function TODO: support namespaces.
Click to show internal directories.
Click to hide internal directories.