Class BowireBenchmarkScheduleStore

Namespace
Kuestenlogik.Bowire.Benchmarking
Assembly
Kuestenlogik.Bowire.Benchmarking.dll

On-disk store for benchmark schedules and their run history (#232), under .bowire/benchmark-schedules/.

Persistence is the restart-survival requirement: the hosted service holds no schedule state of its own, it re-reads this directory on boot. One JSON file per schedule, plus a sibling <id>.runs.json holding the newest-first history, so a run appended by a firing never rewrites the schedule definition an operator may be editing.

public sealed class BowireBenchmarkScheduleStore
Inheritance
BowireBenchmarkScheduleStore
Inherited Members

Constructors

BowireBenchmarkScheduleStore(string?)

Create a store rooted at rootPath (defaults to the current directory).

public BowireBenchmarkScheduleStore(string? rootPath = null)

Parameters

rootPath string

Fields

DirectoryName

Directory name under the project's .bowire folder.

public const string DirectoryName = "benchmark-schedules"

Field Value

string

MaxRunsPerSchedule

How many runs are kept per schedule before the oldest are dropped.

public const int MaxRunsPerSchedule = 50

Field Value

int

Properties

Directory

The resolved schedules directory.

public string Directory { get; }

Property Value

string

Methods

AppendRunAsync(BowireBenchmarkScheduleRun, CancellationToken)

Prepend a run to the schedule's history, trimming to MaxRunsPerSchedule. Newest-first so a reader wanting "how did the last run go?" takes the first element.

public Task AppendRunAsync(BowireBenchmarkScheduleRun run, CancellationToken ct = default)

Parameters

run BowireBenchmarkScheduleRun
ct CancellationToken

Returns

Task

Delete(string)

Remove a schedule and its history. Returns false when it wasn't there.

public bool Delete(string id)

Parameters

id string

Returns

bool

LoadAllAsync(CancellationToken)

Every stored schedule. A missing directory is an empty list, and an unreadable or malformed file is skipped — one bad file must not stop the other schedules from running.

public Task<List<BowireBenchmarkSchedule>> LoadAllAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<List<BowireBenchmarkSchedule>>

LoadAsync(string, CancellationToken)

Read one schedule by id, or null when it isn't stored.

public Task<BowireBenchmarkSchedule?> LoadAsync(string id, CancellationToken ct = default)

Parameters

id string
ct CancellationToken

Returns

Task<BowireBenchmarkSchedule>

LoadRunsAsync(string, CancellationToken)

Run history for a schedule, newest first.

public Task<List<BowireBenchmarkScheduleRun>> LoadRunsAsync(string id, CancellationToken ct = default)

Parameters

id string
ct CancellationToken

Returns

Task<List<BowireBenchmarkScheduleRun>>

SaveAsync(BowireBenchmarkSchedule, CancellationToken)

Write a schedule, creating the directory when needed.

public Task<string> SaveAsync(BowireBenchmarkSchedule schedule, CancellationToken ct = default)

Parameters

schedule BowireBenchmarkSchedule
ct CancellationToken

Returns

Task<string>