You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment there is no way to remove extended providers, only add. We need to add such capability in the case if one would like to stop advertising an endpoint.
The text was updated successfully, but these errors were encountered:
olizilla
added a commit
to storacha/ipni
that referenced
this issue
May 17, 2023
#8)
the expected way to use extended providers is with a special advert that
doesn't include a context or entries, so a helper is provider to help
guide usage. The Advertisement constructor lets you do anything that's
legal but requires you to pass null for the special case of a ad with no
context id, entries or previous cid. While the helper lets you skip
those nulls as you've clearly opt'd in to the extendedProvider world.
```js
/**
* Advertise that **all** past and future entries in this chain are now
* available from a new, additional provider by specifying the root provider
* and the additional providers along with no context id and no entries cid.
*
* To advertise that subset of entries are available from additional providers
* specify the relevant context id to identify that group.
*
* Note: it is not yet possible to unannounce an extended provider once announced.
* see: ipni/storetheindex#1745
*
* @param {object} config
* @param {Provider[]} config.providers
* @param {Link | null} config.previous
* @param {Bytes | null} [config.context]
*/
export function createExtendedProviderAd ({ previous, providers, context = null }) {
if (!providers || !Array.isArray(providers) || providers.length < 2) {
throw new Error('at least 2 providers are required, the root provider and the new extended provider')
}
return new Advertisement({ previous, providers, entries: null, context })
}
```
Adds and reworks some missing validation checks and typos.
License: MIT
---------
Signed-off-by: Oli Evans <[email protected]>
At the moment there is no way to remove extended providers, only add. We need to add such capability in the case if one would like to stop advertising an endpoint.
The text was updated successfully, but these errors were encountered: