Documentation
¶
Index ¶
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) *HealthChecker
NewHealthChecker creates a provider health checker.
type ListOptions ¶
type ListOptions struct {
ActiveOnly bool
}
ListOptions controls provider listing behavior.
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"`
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"`
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.