provider

package
v0.1.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHealth

func CheckHealth(ctx context.Context, serviceURL string, timeout time.Duration) string

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

func FormatSize(b *big.Int) string

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.

func (*HealthChecker) Check

func (h *HealthChecker) Check(ctx context.Context, serviceURL string, timeout time.Duration) string

Check performs a single provider health probe.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL