Table of Contents

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

httpClient HttpClient

The client used to fetch lists.

cacheDirectory string

Where raw lists are cached.

downloadsRoot string

The host's downloads root, under which packages are saved in DownloadFolderFor(Uri); null when downloads are not indexed.

probe DatasetProbe

Reads metadata (bounds) from downloaded loose cells.

options FeedCacheOptions

Cache options; defaults to Default.

timeProvider TimeProvider

The clock; defaults to System.

Methods

CanIndex(CollectionSource)

Returns true when this indexer handles source.

public bool CanIndex(CollectionSource source)

Parameters

source CollectionSource

Returns

bool

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

catalogUri Uri

Returns

string

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

catalogUri Uri
forceRevalidate bool
cancellationToken CancellationToken

Returns

Task<ChartCatalogsProductCatalog>

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

source CollectionSource
cancellationToken CancellationToken

Returns

ValueTask<string>

IndexAsync(CollectionSource, IProgress<IndexProgress>?, CancellationToken)

Indexes source.

public ValueTask<SourceIndex> IndexAsync(CollectionSource source, IProgress<IndexProgress>? progress, CancellationToken cancellationToken)

Parameters

source CollectionSource
progress IProgress<IndexProgress>
cancellationToken CancellationToken

Returns

ValueTask<SourceIndex>

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

chart ChartCatalogsChart

Returns

string

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

catalog ChartCatalogsProductCatalog
filter ChartCatalogsFilter

Returns

IEnumerable<ChartCatalogsChart>