Documentation
¶
Overview ¶
Package budget provides operation budgets with stop/pause/degrade behaviors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Budget ¶
type Budget struct {
// contains filtered or unexported fields
}
Budget tracks usage against configured limits.
func (*Budget) Allow ¶
Allow checks whether work may proceed. Returns ErrPaused/ErrExhausted when blocked.
func (*Budget) IsDegraded ¶
IsDegraded reports degrade behavior is active.
type Config ¶
type Config struct {
Name string
MaxBytes int64
MaxDuration time.Duration
MaxRetries int
OnExhausted Behavior
}
Config defines budget limits.
type State ¶
type State struct {
Name string `json:"name"`
Bytes int64 `json:"bytes"`
MaxBytes int64 `json:"max_bytes,omitempty"`
Retries int `json:"retries"`
MaxRetries int `json:"max_retries,omitempty"`
Elapsed string `json:"elapsed,omitempty"`
MaxDuration string `json:"max_duration,omitempty"`
Paused bool `json:"paused"`
Degraded bool `json:"degraded"`
Exhausted bool `json:"exhausted"`
Behavior Behavior `json:"behavior"`
}
State is a sanitized snapshot of budget usage.
Click to show internal directories.
Click to hide internal directories.