Interface IFlowServerStore
- Namespace
- FlowOrchestrator.Core.Storage
- Assembly
- FlowOrchestrator.Core.dll
Registry of the FlowOrchestrator processes ("servers") sharing a store: each one upserts a heartbeat row on an interval, and the dashboard's Servers view lists them.
public interface IFlowServerStore
Remarks
Optional and separate from the run stores, so a custom storage backend that does not implement it keeps working: without a registered implementation the heartbeat service does nothing and the dashboard reports that the storage does not track servers. The SQL Server, PostgreSQL and in-memory backends implement it.
Timestamps (StartedAt, LastHeartbeatAt) come from the store's own clock — the database server's for SQL backends — so every replica is measured against the same clock, whatever the skew between the machines. Never on the step hot path: one write per heartbeat interval per process.
Methods
GetServersAsync(CancellationToken)
Returns every recorded server, most recent heartbeat first.
Task<IReadOnlyList<FlowServerRecord>> GetServersAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<IReadOnlyList<FlowServerRecord>>
The servers; empty when none is recorded.
PurgeServersAsync(TimeSpan, CancellationToken)
Removes every server whose latest heartbeat is older than notSeenFor, by the store's clock.
Task<int> PurgeServersAsync(TimeSpan notSeenFor, CancellationToken cancellationToken = default)
Parameters
notSeenForTimeSpanAge of the latest heartbeat beyond which a server is considered gone; must be positive.
cancellationTokenCancellationTokenCancels the delete.
Returns
RemoveServerAsync(string, CancellationToken)
Removes one server's row; called by a process on graceful shutdown.
Task<bool> RemoveServerAsync(string serverId, CancellationToken cancellationToken = default)
Parameters
serverIdstringThe ServerId to remove.
cancellationTokenCancellationTokenCancels the delete.
Returns
UpsertServerAsync(FlowServerRecord, CancellationToken)
Inserts the server's row, or updates every column of an existing one except StartedAt, and stamps LastHeartbeatAt with the store's current time.
Task UpsertServerAsync(FlowServerRecord server, CancellationToken cancellationToken = default)
Parameters
serverFlowServerRecordThe heartbeat; its StartedAt and LastHeartbeatAt are ignored.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task
A task that completes when the heartbeat is durable.