provider

package
v0.0.0-...-2f7e0dd Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const LogName = "lazygate.provider"

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocation

type Allocation interface {
	Stop() error  // Stop stops the allocation.
	Start() error // Start starts the allocation.

	State() AllocationState                                          // State returns current allocation state.
	ParseConfig(cfg interface{}, prefix string) (interface{}, error) // ParseConfig parses specific config of allocation.
}

Allocation represents physical allocation.

type AllocationConfig

type AllocationConfig struct {
	Server    string                `validate:"required"` // The upstream server name.
	Namespace string                // Namespace to associate this allocation with.
	Queues    []string              // List of queues to try.
	Time      *AllocationTimeConfig // Time related server configuration.
}

func DefaultAllocationConfig

func DefaultAllocationConfig() *AllocationConfig

func ParseAllocationConfig

func ParseAllocationConfig(alloc Allocation) (*AllocationConfig, error)

type AllocationState

type AllocationState uint8

AllocationState represents allocation state.

const (
	AllocationStateUnknown AllocationState = iota // Allocation is in unknown state.
	AllocationStateStarted                        // Allocation is in started state.
	AllocationStateStopped                        // Allocation is in stopped state.
)

type AllocationTimeConfig

type AllocationTimeConfig struct {
	MinimumOnline       types.Duration // Minimum duration of time to stay online when server is starting.
	InactivityThreshold types.Duration // Duration of inactivity to stop after.
}

AllocationTimeConfig contains time related server configuration.

type InitOptions

type InitOptions struct {
	Ctx    context.Context // Plugin context.
	Config interface{}     // Provider config.
}

InitOptions represents options to pass to provider initializer.

type Provider

type Provider interface {
	Init(opts *InitOptions) error // Init initializes the provider.
	Name() string                 // Name returns name of provider.
	DefaultConfig() interface{}   // DefaultConfig returns default plugin config.

	AllocationGet(srv proxy.RegisteredServer) (Allocation, error) // AllocationGet returns matching Allocation.
	AllocationList() ([]Allocation, error)                        // AllocationList returns all matching Allocation's.
}

Provider manipulates with registered servers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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