selectProviders
selectProviders(
options):ResolvedLocation[]
Defined in: packages/synapse-core/src/warm-storage/select-providers.ts:32
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, compact datasets sort before legacy ones, then those with existing pieces sort before empty ones, and older datasets (lower ID) sort before newer ones.
With providerId, the pool is that one provider, whether or not it is
endorsed, and the result is its best matching dataset or a new-dataset
location. The result is empty when the provider is not in providers or is
listed in excludeProviderIds.
This function does NOT perform health checks. Use selectReachableProviders() to select providers that answer a ping.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options |
ProviderSelectionOptions |
Pre-fetched chain data and selection parameters |
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.