Documentation
¶
Index ¶
- Constants
- Variables
- func Interval(settings map[string]any, fallback time.Duration) time.Duration
- func Next(now time.Time, interval time.Duration) time.Time
- func RetryDelay(interval time.Duration, failures int, jitter float64) time.Duration
- type PollState
- type RefreshPolicy
- type Resources
- func (r *Resources) Begin(key string) (uint64, error)
- func (r *Resources) Complete(key string, generation uint64, value any, failed bool, now time.Time, ...) bool
- func (r *Resources) Deadline(key string) time.Time
- func (r *Resources) Due(now time.Time) []string
- func (r *Resources) Snapshot(context string) (PollState, bool)
- func (r *Resources) Unwatch(context string)
- func (r *Resources) Watch(context, key string, interval time.Duration) error
Constants ¶
const UpdateIntervalKey = "update_interval_ms"
Variables ¶
var Never = time.Date(9999, 1, 1, 0, 0, 0, 0, time.UTC)
Never is a disabled periodic deadline, distinct from a zero/initial deadline
Functions ¶
func Interval ¶
Interval preserves a caller's existing default (including adaptive and legacy intervals) unless the binding explicitly overrides it. Invalid saved values retain that default; editors use Resolve to report errors before saving
Types ¶
type PollState ¶
type PollState struct {
Next time.Time
Failures int
LastValue any
Stale bool
ObservedAt time.Time
Available bool
}
PollState stores a resource's last good sample independently of its subscribers
type RefreshPolicy ¶
type RefreshPolicy struct {
DefaultMS int64 `json:"default_ms"`
MinimumMS int64 `json:"minimum_ms"`
MaximumMS int64 `json:"maximum_ms"`
}
RefreshPolicy describes periodic reads only, never command execution
type Resources ¶
func (*Resources) Complete ¶
func (r *Resources) Complete(key string, generation uint64, value any, failed bool, now time.Time, jitter float64, retryAt time.Time) bool
Accept a current poll result and ignore obsolete generations
func (*Resources) Deadline ¶
Deadline includes a service cooldown even after an explicit invalidation