Documentation
¶
Index ¶
- func CheckHealth(ctx context.Context, serviceURL string, timeout time.Duration) string
- func CheckHealthBatch(ctx context.Context, providers []ProviderDetail, timeout time.Duration)
- func FormatSize(b *big.Int) string
- type HealthChecker
- type HealthResult
- type ListOptions
- type PartialListError
- type ProviderDetail
- type RegistryService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHealth ¶
CheckHealth performs a PDP ping against the given service URL and returns "reachable", "unreachable", or "n/a" (for empty URLs).
func CheckHealthBatch ¶
func CheckHealthBatch(ctx context.Context, providers []ProviderDetail, timeout time.Duration)
CheckHealthBatch performs concurrent health checks on all providers in the slice, updating each provider's HealthStatus in place. The concurrency is bounded to avoid overwhelming the network.
func FormatSize ¶
FormatSize converts a byte count to a human-readable size string (e.g., "1 MiB", "32 GiB").
Types ¶
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker performs provider health probes with a reusable HTTP client.
func NewHealthChecker ¶
func NewHealthChecker(client *http.Client, formatters ...func(error) string) *HealthChecker
NewHealthChecker creates a provider health checker.
func (*HealthChecker) Probe ¶
func (h *HealthChecker) Probe(ctx context.Context, serviceURL string, timeout time.Duration) HealthResult
Probe performs a single provider health probe and explains a failure.
type HealthResult ¶
HealthResult is the outcome of one provider health probe. Status is "reachable", "unreachable", or "n/a" (no service URL). Detail explains a failed probe to operators with a redacted diagnostic.
type ListOptions ¶
type ListOptions struct {
ActiveOnly bool
}
ListOptions controls provider listing behavior.
type PartialListError ¶
type PartialListError struct{ Failures []error }
PartialListError reports provider lookups omitted from a partial result.
func (*PartialListError) Error ¶
func (e *PartialListError) Error() string
func (*PartialListError) Unwrap ¶
func (e *PartialListError) Unwrap() []error
type ProviderDetail ¶
type ProviderDetail struct {
ID types.OnChainID `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Active bool `json:"active"`
Address common.Address `json:"address"`
Payee common.Address `json:"payee"`
HasPDP bool `json:"has_pdp"`
ServiceURL string `json:"service_url,omitempty"`
MinPieceSize *big.Int `json:"min_piece_size,omitempty"`
MaxPieceSize *big.Int `json:"max_piece_size,omitempty"`
StoragePrice *big.Int `json:"storage_price,omitempty"`
MinProvingPeriod *big.Int `json:"min_proving_period,omitempty"`
PaymentToken common.Address `json:"payment_token"`
IPNIPiece bool `json:"ipni_piece"`
IPNIIPFS bool `json:"ipni_ipfs"`
IPNIPeerID string `json:"ipni_peer_id,omitempty"`
ExtraCapabilities map[string][]byte `json:"extra_capabilities,omitempty"`
Location string `json:"location,omitempty"`
HealthStatus string `json:"health_status"`
}
ProviderDetail is the enriched output combining provider info, PDP offering, and health status.
func ListProviders ¶
func ListProviders(ctx context.Context, reg *RegistryService, opts ListOptions) ([]ProviderDetail, error)
ListProviders returns PDP providers, optionally filtered to active-only.
func LookupProvider ¶
func LookupProvider(ctx context.Context, reg *RegistryService, providerID sdktypes.BigInt) (ProviderDetail, error)
type RegistryService ¶
type RegistryService struct {
// contains filtered or unexported fields
}
RegistryService wraps the synapse-go spregistry.Service for provider listing.
func NewRegistryService ¶
func NewRegistryService(svc *spregistry.Service) *RegistryService
NewRegistryService creates a RegistryService from a synapse-go SPRegistry service.