Documentation
¶
Overview ¶
Package availability owns runtime state for exact provider offerings.
Index ¶
- Variables
- type Clock
- type Config
- type Offering
- type Publisher
- type Record
- type Snapshot
- type State
- type Tracker
- func (t *Tracker) Acquire(route routing.Route) bool
- func (t *Tracker) LastPublishError() error
- func (t *Tracker) RecordFailure(route routing.Route, providerFailure *failure.Failure, _ time.Duration)
- func (t *Tracker) RecordSuccess(route routing.Route, _ time.Duration)
- func (t *Tracker) Refresh(_ context.Context)
- func (t *Tracker) Reset(offering Offering) error
- func (t *Tracker) Snapshot() Snapshot
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidOffering reports an incomplete offering identity. ErrInvalidOffering = errors.New("provider offering identity is incomplete") // ErrInvalidConfig reports an invalid availability policy. ErrInvalidConfig = errors.New("availability configuration is invalid") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config defines the offering circuit policy.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the production availability policy.
type Offering ¶
Offering identifies one provider model endpoint.
func OfferingFromRoute ¶
OfferingFromRoute converts a planned route to runtime identity.
type State ¶
type State string
State identifies one offering's runtime availability state.
const ( // StateHealthy admits normal attempts for an offering. StateHealthy State = "healthy" // StateOpen rejects attempts until the open interval expires. StateOpen State = "open" // StateHalfOpen admits one recovery probe. StateHalfOpen State = "half_open" StateUnavailable State = "unavailable" )
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker owns all offering state transitions and half-open probe admission.
func (*Tracker) Acquire ¶
Acquire admits one attempt. A half-open offering admits one probe at a time.
func (*Tracker) LastPublishError ¶
LastPublishError returns the latest derived-projection publication error.
func (*Tracker) RecordFailure ¶
func (t *Tracker) RecordFailure(route routing.Route, providerFailure *failure.Failure, _ time.Duration)
RecordFailure applies one normalized failure to the offering state machine.
func (*Tracker) RecordSuccess ¶
RecordSuccess closes the offering circuit and clears failure evidence.