Table of Contents

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

cancellationToken CancellationToken

Cancels 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

notSeenFor TimeSpan

Age of the latest heartbeat beyond which a server is considered gone; must be positive.

cancellationToken CancellationToken

Cancels the delete.

Returns

Task<int>

The number of rows removed.

RemoveServerAsync(string, CancellationToken)

Removes one server's row; called by a process on graceful shutdown.

Task<bool> RemoveServerAsync(string serverId, CancellationToken cancellationToken = default)

Parameters

serverId string

The ServerId to remove.

cancellationToken CancellationToken

Cancels the delete.

Returns

Task<bool>

true when a row was removed; false when none matched.

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

server FlowServerRecord

The heartbeat; its StartedAt and LastHeartbeatAt are ignored.

cancellationToken CancellationToken

Cancels the write.

Returns

Task

A task that completes when the heartbeat is durable.