Documentation ¶
Index ¶
- Constants
- func ConfigureContainerRequestMounts(stubObjectId string, workspace *types.Workspace, config types.StubConfigV1, ...) ([]types.Mount, error)
- func ConfigureContainerRequestSecrets(workspace *types.Workspace, stubConfig types.StubConfigV1) ([]string, error)
- type AutoscaledInstance
- func (i *AutoscaledInstance) ConsumeContainerEvent(event types.ContainerEvent)
- func (i *AutoscaledInstance) ConsumeScaleResult(result *AutoscalerResult)
- func (i *AutoscaledInstance) HandleScalingEvent(desiredContainers int) error
- func (i *AutoscaledInstance) Monitor() error
- func (i *AutoscaledInstance) Reload() error
- func (i *AutoscaledInstance) State() (*AutoscaledInstanceState, error)
- func (i *AutoscaledInstance) WaitForContainer(ctx context.Context, duration time.Duration) (*types.ContainerState, error)
- type AutoscaledInstanceConfig
- type AutoscaledInstanceState
- type Autoscaler
- type AutoscalerResult
- type AutoscalerSample
- type ContainerEventManager
- type IAutoscaledInstance
- type IAutoscaler
- type LogStream
- type LogStreamOpts
- type RingBuffer
Constants ¶
View Source
const IgnoreScalingEventInterval = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AutoscaledInstance ¶
type AutoscaledInstance struct { Ctx context.Context AppConfig types.AppConfig CancelFunc context.CancelFunc Name string Rdb *common.RedisClient Lock *common.RedisLock IsActive bool FailedContainerThreshold int // DB objects Workspace *types.Workspace Stub *types.StubWithRelated StubConfig *types.StubConfigV1 Object *types.Object Token *types.Token // Scheduling Scheduler *scheduler.Scheduler ContainerEventChan chan types.ContainerEvent Containers map[string]bool ScaleEventChan chan int EntryPoint []string Autoscaler IAutoscaler // Repositories ContainerRepo repository.ContainerRepository BackendRepo repository.BackendRepository TaskRepo repository.TaskRepository // Keys InstanceLockKey string // Callbacks StartContainersFunc func(containersToRun int) error StopContainersFunc func(containersToStop int) error }
func NewAutoscaledInstance ¶
func NewAutoscaledInstance(ctx context.Context, cfg *AutoscaledInstanceConfig) (*AutoscaledInstance, error)
func (*AutoscaledInstance) ConsumeContainerEvent ¶
func (i *AutoscaledInstance) ConsumeContainerEvent(event types.ContainerEvent)
func (*AutoscaledInstance) ConsumeScaleResult ¶
func (i *AutoscaledInstance) ConsumeScaleResult(result *AutoscalerResult)
func (*AutoscaledInstance) HandleScalingEvent ¶
func (i *AutoscaledInstance) HandleScalingEvent(desiredContainers int) error
func (*AutoscaledInstance) Monitor ¶
func (i *AutoscaledInstance) Monitor() error
func (*AutoscaledInstance) Reload ¶
func (i *AutoscaledInstance) Reload() error
Reload updates state that should be changed on the instance. If a stub has a deployment associated with it, we update the IsActive field.
func (*AutoscaledInstance) State ¶
func (i *AutoscaledInstance) State() (*AutoscaledInstanceState, error)
func (*AutoscaledInstance) WaitForContainer ¶
func (i *AutoscaledInstance) WaitForContainer(ctx context.Context, duration time.Duration) (*types.ContainerState, error)
type AutoscaledInstanceConfig ¶
type AutoscaledInstanceConfig struct { Name string AppConfig types.AppConfig Workspace *types.Workspace Stub *types.StubWithRelated StubConfig *types.StubConfigV1 Object *types.Object Token *types.Token Scheduler *scheduler.Scheduler Rdb *common.RedisClient InstanceLockKey string ContainerRepo repository.ContainerRepository BackendRepo repository.BackendRepository TaskRepo repository.TaskRepository StartContainersFunc func(containersToRun int) error StopContainersFunc func(containersToStop int) error }
type AutoscaledInstanceState ¶
type Autoscaler ¶
type Autoscaler[I IAutoscaledInstance, S AutoscalerSample] struct { // contains filtered or unexported fields }
func NewAutoscaler ¶
func NewAutoscaler[I IAutoscaledInstance, S AutoscalerSample](instance I, sampleFunc func(I) (S, error), scaleFunc func(I, S) *AutoscalerResult) *Autoscaler[I, S]
func (*Autoscaler[I, S]) Start ¶
func (as *Autoscaler[I, S]) Start(ctx context.Context)
Start the autoscaler
type AutoscalerResult ¶
type AutoscalerSample ¶
type AutoscalerSample interface{}
type ContainerEventManager ¶
type ContainerEventManager struct {
// contains filtered or unexported fields
}
func NewContainerEventManager ¶
func NewContainerEventManager(containerPrefix string, keyEventManager *common.KeyEventManager, instanceFactory func(stubId string, options ...func(IAutoscaledInstance)) (IAutoscaledInstance, error)) (*ContainerEventManager, error)
func (*ContainerEventManager) Listen ¶
func (em *ContainerEventManager) Listen(ctx context.Context)
type IAutoscaledInstance ¶
type IAutoscaledInstance interface { ConsumeScaleResult(*AutoscalerResult) ConsumeContainerEvent(types.ContainerEvent) }
type IAutoscaler ¶
type LogStream ¶
type LogStream struct {
// contains filtered or unexported fields
}
func NewLogStream ¶
func NewLogStream(opts LogStreamOpts) (*LogStream, error)
type LogStreamOpts ¶
type LogStreamOpts struct { SendCallback func(o common.OutputMsg) error ExitCallback func(exitCode int32) error ContainerRepo repository.ContainerRepository Tailscale *network.Tailscale Config types.AppConfig KeyEventManager *common.KeyEventManager }
type RingBuffer ¶
type RingBuffer[T any] struct { // contains filtered or unexported fields }
func NewRingBuffer ¶
func NewRingBuffer[T any](size int) *RingBuffer[T]
func (*RingBuffer[T]) Len ¶
func (rb *RingBuffer[T]) Len() int
func (*RingBuffer[T]) Pop ¶
func (rb *RingBuffer[T]) Pop() (T, bool)
Pop retrieves and removes the oldest request from the buffer
func (*RingBuffer[T]) Push ¶
func (rb *RingBuffer[T]) Push(request T, priority bool)
Push adds a new request to the buffer. If priority is true, it gets inserted at the front of the buffer
Click to show internal directories.
Click to hide internal directories.