selectProviders
selectProviders(
input,options?):ResolvedLocation[]
Defined in: packages/synapse-core/src/warm-storage/select-providers.ts:28
Select providers for storage from an eligible pool.
The eligible provider pool is determined by endorsedIds:
- Non-empty: only providers in this set are considered (use for primary selection)
- Empty: all providers in the
providerslist are considered (use for secondary selection)
Within the eligible pool, providers with an existing metadata-matching dataset are preferred (reuses payment rail). Otherwise a provider without a matching dataset is selected (new dataset created on commit).
Within matching datasets, those with existing pieces sort before empty ones, and older datasets (lower ID) sort before newer ones.
This function does NOT perform health checks — the caller should validate reachability via SP.ping() and call again with excludeProviderIds if a provider fails.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input | ProviderSelectionInput | Pre-fetched chain data for selection |
options? | ProviderSelectionOptions | Selection options (count, exclusions) |
Returns
Section titled “Returns”Ranked array of locations up to count length.
May be shorter if fewer providers are available.
Empty if no providers match constraints.