api

package
v0.12.9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	GetResourceUsage() (*queue_info.ClusterUsage, error)
}

type UsageDBConfig

type UsageDBConfig struct {
	ClientType             string       `yaml:"clientType" json:"clientType"`
	ConnectionString       string       `yaml:"connectionString,omitempty" json:"connectionString,omitempty"`
	ConnectionStringEnvVar string       `yaml:"connectionStringEnvVar,omitempty" json:"connectionStringEnvVar,omitempty"`
	UsageParams            *UsageParams `yaml:"usageParams,omitempty" json:"usageParams,omitempty"`
}

func (*UsageDBConfig) DeepCopy added in v0.10.0

func (c *UsageDBConfig) DeepCopy() *UsageDBConfig

func (*UsageDBConfig) GetUsageParams added in v0.8.2

func (c *UsageDBConfig) GetUsageParams() *UsageParams

GetUsageParams returns the usage params if set, and default params if not set.

type UsageParams added in v0.8.2

type UsageParams struct {
	// Half life period of the usage. If not set, or set to 0, the usage will not be decayed.
	HalfLifePeriod *metav1.Duration `yaml:"halfLifePeriod,omitempty" json:"halfLifePeriod,omitempty"`
	// Window size of the usage. Default is 1 week.
	WindowSize *metav1.Duration `yaml:"windowSize,omitempty" json:"windowSize,omitempty"`
	// Window type for time-series aggregation. If not set, defaults to sliding.
	WindowType *WindowType `yaml:"windowType,omitempty" json:"windowType,omitempty"`
	// The start timestamp of the tumbling window. If not set, defaults to the current time.
	TumblingWindowStartTime *metav1.Time `yaml:"tumblingWindowStartTime,omitempty" json:"tumblingWindowStartTime,omitempty"`
	// The cron string defining the behavior of the cron window.
	CronString string `yaml:"cronString,omitempty" json:"cronString,omitempty"`
	// Fetch interval of the usage. Default is 1 minute.
	FetchInterval *metav1.Duration `yaml:"fetchInterval,omitempty" json:"fetchInterval,omitempty"`
	// Staleness period of the usage. Default is 5 minutes.
	StalenessPeriod *metav1.Duration `yaml:"stalenessPeriod,omitempty" json:"stalenessPeriod,omitempty"`
	// Wait timeout of the usage. Default is 1 minute.
	WaitTimeout *metav1.Duration `yaml:"waitTimeout,omitempty" json:"waitTimeout,omitempty"`

	// ExtraParams are extra parameters for the usage db client, which are client specific.
	ExtraParams map[string]string `yaml:"extraParams,omitempty" json:"extraParams,omitempty"`
}

UsageParams defines common params for all usage db clients. Some clients may not support all the params.

func (*UsageParams) DeepCopy added in v0.10.0

func (p *UsageParams) DeepCopy() *UsageParams

func (*UsageParams) GetExtraDurationParamOrDefault added in v0.8.3

func (p *UsageParams) GetExtraDurationParamOrDefault(key string, defaultValue time.Duration) time.Duration

func (*UsageParams) GetExtraStringParamOrDefault added in v0.8.3

func (p *UsageParams) GetExtraStringParamOrDefault(key string, defaultValue string) string

func (*UsageParams) SetDefaults added in v0.8.2

func (p *UsageParams) SetDefaults()

type WindowType added in v0.8.2

type WindowType string

WindowType defines the type of time window for aggregating usage data

const (
	// TumblingWindow represents non-overlapping, fixed-size time windows
	// Example: 1-hour windows at 0-1h, 1-2h, 2-3h
	TumblingWindow WindowType = "tumbling"

	// CronWindow represents a tumbling window that is defined by a cron string.
	// In this configuration, the window size is not used, and the window is defined by the cron string.
	// Example: every 1 hour at 00:00:00, every 1 hour at 01:00:00, etc.
	CronWindow WindowType = "cron"

	// SlidingWindow represents overlapping time windows that slide forward
	// Example: a 1-hour sliding window will consider the usage of the last 1 hour prior to the current time.
	SlidingWindow WindowType = "sliding"
)

func (WindowType) IsValid added in v0.8.2

func (wt WindowType) IsValid() bool

IsValid returns true if the WindowType is a valid value

Jump to

Keyboard shortcuts

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