qbas

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Ratio        float64 `json:"ratio"`
	MinRatio     float64 `json:"minRatio"`
	MaxStep      int64   `json:"maxStep"`
	MaxInstances int64   `json:"maxInstances"`
	MinInstances int64   `json:"minInstances"`
}

type InstanceManager

type InstanceManager interface {
	Size(ctx context.Context) (int64, error)
	Resize(ctx context.Context, newSize int64) error
	ScaleDown(ctx context.Context, newSize int64) error
}

type Operation

type Operation struct {
	Backlog   int64 `json:"backlog"`
	Instances int64 `json:"instances"`
	Delta     int64 `json:"delta"`
}

func Autoscale

func Autoscale(ctx context.Context, cfg Config, qbim QueueBasedInstanceManager) (Operation, error)

type Queue

type Queue interface {
	Backlog(ctx context.Context) (int64, error)
}

type QueueBasedInstanceManager

type QueueBasedInstanceManager interface {
	Queue
	InstanceManager
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL