Class LocalCatalogueProvider
- Namespace
- Kuestenlogik.Bowire.Sources
- Assembly
- Kuestenlogik.Bowire.dll
Reads catalogue entries from a JSON file on disk — the simplest
of the built-in providers (#136 Phase A). The path comes from
Path; when null the
provider falls back to ~/.bowire/catalogue.json.
public sealed class LocalCatalogueProvider : IBowireCatalogueProvider
- Inheritance
-
LocalCatalogueProvider
- Implements
- Inherited Members
Remarks
A missing file resolves to an empty catalogue rather than an
error so a host can enable the provider before any catalogue
file exists and have the first write light up automatically on
the next refresh. Malformed JSON DOES throw — the registry
surfaces it on GET /api/catalogue/entries so the operator
can spot the typo without spelunking through logs.
The reader runs on a fresh FileStream per refresh
— no in-memory cache — because the whole point of the local
provider is editing the file by hand and re-loading. The cost is
trivial for any realistic catalogue size; if a multi-tenant
deployment ever needs a faster read path it can swap in the
http provider pointing at a relay.
Constructors
LocalCatalogueProvider()
Parameterless ctor for the assembly-scan discovery path.
Uses the default path resolution (env BOWIRE_CATALOGUE_PATH
override → ~/.bowire/catalogue.json) so the registry
can instantiate the provider without any host-side wiring.
public LocalCatalogueProvider()
Properties
Id
Stable id used to select this provider in config (e.g.
"local", "http", "consul",
"kubernetes", "agent"). Compared case-insensitively
against the configured provider key.
public string Id { get; }
Property Value
Name
Human-readable provider name for the Settings → Sources tab
and startup logs (e.g. "Local file",
"HTTP endpoint", "Consul").
public string Name { get; }
Property Value
Methods
FetchAsync(CancellationToken)
Fetch the current catalogue snapshot. Called on a configurable refresh interval (default 5 minutes; see RefreshInterval) and on a manual trigger from the workbench UI.
public Task<IReadOnlyList<BowireCatalogueEntry>> FetchAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token — refresh cycles are bounded by the configured interval, so providers should respect it to avoid piling up overlapping fetches when an upstream is slow.
Returns
- Task<IReadOnlyList<BowireCatalogueEntry>>
The list of catalogue entries currently visible to this provider. Empty list is fine (means "no entries"); throw to signal a hard fetch failure — the registry catches and surfaces it as a problem-details response on
GET /api/catalogue/entries.