scaletozero

package
v0.0.0-...-6026c52 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(ctrl Controller) func(http.Handler) http.Handler

Middleware returns a standard net/http middleware that disables scale-to-zero at the start of each request and re-enables it after the handler completes. Connections from loopback addresses are ignored and do not affect the scale-to-zero state.

Types

type Controller

type Controller interface {
	// Disable turns scale-to-zero off.
	Disable(ctx context.Context) error
	// Enable re-enables scale-to-zero after it has previously been disabled.
	Enable(ctx context.Context) error
}

func NewDebouncedController

func NewDebouncedController(ctrl Controller) Controller

func NewUnikraftCloudController

func NewUnikraftCloudController() Controller

type DebouncedController

type DebouncedController struct {
	// contains filtered or unexported fields
}

func (*DebouncedController) Disable

func (c *DebouncedController) Disable(ctx context.Context) error

func (*DebouncedController) Enable

func (c *DebouncedController) Enable(ctx context.Context) error

type NoopController

type NoopController struct{}

func NewNoopController

func NewNoopController() *NoopController

func (NoopController) Disable

func (NoopController) Enable

type Oncer

type Oncer struct {
	// contains filtered or unexported fields
}

Oncer wraps a Controller and ensures that Disable and Enable are called at most once.

func NewOncer

func NewOncer(c Controller) *Oncer

func (*Oncer) Disable

func (o *Oncer) Disable(ctx context.Context) error

func (*Oncer) Enable

func (o *Oncer) Enable(ctx context.Context) error

Jump to

Keyboard shortcuts

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