Class ChartCatalogsFeedIndexer
- Namespace
- EncDotNet.S100.Collections.Indexing
- Assembly
- EncDotNet.S100.Collections.dll
Indexes a ChartCatalogsFeedSource: fetches (or revalidates) a community chart list and turns each selected entry into items.
public sealed class ChartCatalogsFeedIndexer : ICollectionSourceIndexer
- Inheritance
-
ChartCatalogsFeedIndexer
- Implements
- Inherited Members
Remarks
A community entry is a package — a download that may hold one cell or many — and the lists carry no coverage. So until an entry is downloaded it is a single online item without bounds; once it has been downloaded (into DownloadFolderFor(Uri) under the downloads root) its cells are indexed from the local copy, with their bounds, editions and updates, and listed individually. Every item keeps the package's RemoteItemLocation (with Package set) so hosts can resolve the local copy and offer re-downloads.
Caching follows NoaaEncFeedIndexer. The fingerprint also covers the download state of the selected packages, so a download re-indexes the source.
Constructors
ChartCatalogsFeedIndexer(HttpClient, string, string?, DatasetProbe?, FeedCacheOptions?, TimeProvider?)
Creates an indexer.
public ChartCatalogsFeedIndexer(HttpClient httpClient, string cacheDirectory, string? downloadsRoot = null, DatasetProbe? probe = null, FeedCacheOptions? options = null, TimeProvider? timeProvider = null)
Parameters
httpClientHttpClientThe client used to fetch lists.
cacheDirectorystringWhere raw lists are cached.
downloadsRootstringThe host's downloads root, under which packages are saved in DownloadFolderFor(Uri); null when downloads are not indexed.
probeDatasetProbeReads metadata (bounds) from downloaded loose cells.
optionsFeedCacheOptionsCache options; defaults to Default.
timeProviderTimeProviderThe clock; defaults to System.
Methods
CanIndex(CollectionSource)
Returns true when this indexer handles source.
public bool CanIndex(CollectionSource source)
Parameters
sourceCollectionSource
Returns
DownloadFolderFor(Uri)
The managed folder, relative to the downloads root, that entries of
the list at catalogUri download into (e.g.
community/RO_IENC_Catalog).
public static string DownloadFolderFor(Uri catalogUri)
Parameters
catalogUriUri
Returns
GetCatalogAsync(Uri, bool, CancellationToken)
Returns the (cached or freshly fetched) list at
catalogUri, for example to choose entries.
public Task<ChartCatalogsProductCatalog> GetCatalogAsync(Uri catalogUri, bool forceRevalidate = false, CancellationToken cancellationToken = default)
Parameters
catalogUriUriforceRevalidateboolcancellationTokenCancellationToken
Returns
Exceptions
- HttpRequestException
The server could not be reached and nothing is cached.
GetFingerprintAsync(CollectionSource, CancellationToken)
Cheaply computes a fingerprint of the source's current state. When it equals a previous index's Fingerprint, that index is still valid. Returns null when the state cannot be determined (for example the source is unavailable).
public ValueTask<string?> GetFingerprintAsync(CollectionSource source, CancellationToken cancellationToken)
Parameters
sourceCollectionSourcecancellationTokenCancellationToken
Returns
IndexAsync(CollectionSource, IProgress<IndexProgress>?, CancellationToken)
Indexes source.
public ValueTask<SourceIndex> IndexAsync(CollectionSource source, IProgress<IndexProgress>? progress, CancellationToken cancellationToken)
Parameters
sourceCollectionSourceprogressIProgress<IndexProgress>cancellationTokenCancellationToken
Returns
PackageName(ChartCatalogsChart)
The name an entry's download is saved under: its number, made safe for the file system.
public static string PackageName(ChartCatalogsChart chart)
Parameters
chartChartCatalogsChart
Returns
Selected(ChartCatalogsProductCatalog, ChartCatalogsFilter)
The selected entries, one per package name (lists sometimes repeat an entry).
public static IEnumerable<ChartCatalogsChart> Selected(ChartCatalogsProductCatalog catalog, ChartCatalogsFilter filter)
Parameters
catalogChartCatalogsProductCatalogfilterChartCatalogsFilter