Interface IBowireEntityStore
- Namespace
- Kuestenlogik.Bowire.Workspace.Git
- Assembly
- Kuestenlogik.Bowire.Workspace.Git.dll
Per-entity reader/writer the workbench routes through when a
workspace's storageRoot is set (#196 Phase 2.2). Replaces the
legacy single-bundle layout — environments, collections, recordings,
scripts and flows each live in their own subdirectory under the
checked-out workspace folder so PR diffs show one JSON document per
edited entity rather than the entire bundle on every keystroke.
public interface IBowireEntityStore
Remarks
The FileEntityStore is the concrete on-disk implementation. Tests + Phase 2.4's FS-watch SSE producer can plug their own implementation in via DI without dragging the file-backed shape in.
All methods take an entityKind string rather than an enum so
plugins can carry their own per-entity buckets in a future phase
without us reshaping the interface. Today the canonical set is
"environments" | "collections" | "recordings" | "scripts" | "flows"
— implementations validate against that set up-front so a typo in
the workbench (e.g. "environment" singular) fails fast with a
loud ArgumentException rather than silently writing
outside the canonical layout.
Methods
DeleteAsync(string, string, CancellationToken)
Remove the entity (and any per-request side files for collections). No-op when the entity is already absent so callers can re-run a delete idempotently.
Task DeleteAsync(string entityKind, string id, CancellationToken ct = default)
Parameters
entityKindstringidstringctCancellationToken
Returns
ListAsync(string, CancellationToken)
Enumerate the ids of every entity of entityKind
currently on disk. Order is implementation-defined; the workbench
sorts client-side for stable display.
Task<IReadOnlyList<string>> ListAsync(string entityKind, CancellationToken ct = default)
Parameters
entityKindstringctCancellationToken
Returns
LoadAsync(string, string, CancellationToken)
Read the raw JSON document for id within
entityKind. Returns null when the entity
is absent — callers treat that as "the user hasn't authored one
yet" and don't surface an error.
Task<string?> LoadAsync(string entityKind, string id, CancellationToken ct = default)
Parameters
entityKindstringidstringctCancellationToken
Returns
SaveAsync(string, string, string, CancellationToken)
Persist json as the canonical document for
id within entityKind.
Implementations create the per-kind directory on first write so
the workbench doesn't have to scaffold the layout up-front.
Task SaveAsync(string entityKind, string id, string json, CancellationToken ct = default)
Parameters
entityKindstringidstringjsonstringctCancellationToken