Documentation
¶
Overview ¶
Package providerselect defines provider admission and ranking without I/O.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoTrustedProvider = errors.New("no eligible provider meets the required provider tier") ErrUploadSpeedTestsPending = errors.New("provider upload speed tests are pending") )
Functions ¶
This section is empty.
Types ¶
type Admission ¶
Admission is selection-time evidence, never a persisted provider policy.
type Candidate ¶
type Candidate struct {
ID types.OnChainID
Active bool
HasPDP bool
HasProfile bool
Healthy bool
Fresh bool
ServiceURL string
ProfileURL string
Load int
BytesPerSecond int64
TierListed bool
UploadSpeedSettled bool
TieBreak uint64
ObservationCheckedAt *time.Time
}
func Select ¶
func Select(in Inventory, strategy Strategy, count int, excluded map[string]ExclusionReason, hasTrusted bool) ([]Candidate, error)
Select reserves a trusted candidate first when the remaining set needs one. Random values are supplied by the caller; they only break exact ranking ties.
func (Candidate) IneligibleReason ¶
type ExclusionReason ¶
type ExclusionReason string
const ( ExclusionBucketInUse ExclusionReason = "bucket_in_use" ExclusionPreviouslyUsed ExclusionReason = "previously_used" ExclusionContextOpenFailed ExclusionReason = "context_open_failed" ExclusionSelected ExclusionReason = "selected_this_round" )
func (ExclusionReason) Valid ¶
func (r ExclusionReason) Valid() bool
type IngressEntry ¶
func RankIngress ¶
func RankIngress(entries []IngressEntry) []IngressEntry
RankIngress orders bound replicas by measured speed, then by replica slot.
type ProviderRejection ¶
type SelectionDiagnostics ¶
type SelectionDiagnostics struct {
Tier Tier `json:"tier"`
TierCheckedAt *time.Time `json:"tier_checked_at,omitempty"`
HasTrusted bool `json:"has_trusted"`
RequestedCount int `json:"requested_count"`
EligibleCount int `json:"eligible_count"`
RejectedTotal int `json:"rejected_total"`
RejectedOmitted int `json:"rejected_omitted"`
Rejections []ProviderRejection `json:"rejections"`
// contains filtered or unexported fields
}
func Diagnose ¶
func Diagnose(in Inventory, count int, excluded map[string]ExclusionReason, hasTrusted bool) SelectionDiagnostics
Diagnose records the complete decision inputs without provider URLs or errors.
func (SelectionDiagnostics) NeedsRefresh ¶
func (d SelectionDiagnostics) NeedsRefresh() bool
NeedsRefresh is computed from all selection obstacles before diagnostics are capped.
type SelectionError ¶
type SelectionError struct {
Kind SelectionFailureKind
Cause error
Diagnostics SelectionDiagnostics
}
func (*SelectionError) Error ¶
func (e *SelectionError) Error() string
func (*SelectionError) Unwrap ¶
func (e *SelectionError) Unwrap() []error
type SelectionFailureKind ¶
type SelectionFailureKind string
const ( SelectionRequiredTierEmpty SelectionFailureKind = "required_tier_empty" SelectionRequiredTierInUse SelectionFailureKind = "required_tier_in_use" SelectionTemporary SelectionFailureKind = "temporarily_unavailable" SelectionProviderContext SelectionFailureKind = "provider_context_unavailable" SelectionUploadSpeedPending SelectionFailureKind = "upload_speed_tests_pending" )
func (SelectionFailureKind) Valid ¶
func (k SelectionFailureKind) Valid() bool
Click to show internal directories.
Click to hide internal directories.