Table of Contents

Interface IDiscoveryRunStore

Namespace
MailFathom.Application.Discovery.Streaming
Assembly
MailFathom.Application.dll

Where the deployment holds the Discover runs it is executing and the answers they have written so far.

public interface IDiscoveryRunStore

Remarks

A run's output is durable rather than held in the process that composed it, which is what makes it reachable from every replica: the client reading it is routed wherever the load balancer likes, its screen may be a second one the same person opened, and a rolling upgrade moves it between builds. ADR 0035 is that decision, and this is the seam it is applied through.

What it holds is mail-derived and sensitive throughout. A block quotes somebody's correspondence and a citation names the message it was drawn from, so nothing read or written here reaches a log, a span, a metric, or a failure message, and the retention the run's own bounds fix is enforced by this store rather than left to a reader to remember.

Every statement is one round trip and takes its own decision. Opening sweeps, counts, and inserts together, so the bound is the deployment's rather than a number each replica finds room under separately; appending assigns the sequence where the row is written, so nothing outside the database decides what a run has reached; and reading stamps the run as used, so the retention window runs from the last read as the page says it does.

Methods

AppendAsync(DiscoveryRunId, DiscoveryRunEvent, DateTimeOffset, CancellationToken)

Writes one event into a run, giving it the next place in that run.

ReadAsync(DiscoveryRunId, UserId, long, DateTimeOffset, CancellationToken)

Reads a run this user started, from a stated point, and records that it was read.

RemoveForgottenAsync(DateTimeOffset, CancellationToken)

Removes the runs nobody can come back for, and the ones no execution can still be reporting.

TryOpenAsync(DiscoveryRunId, UserId, DateTimeOffset, CancellationToken)

Opens a run for one user, unless that person is already running as many as they may.

TryRequestStopAsync(DiscoveryRunId, UserId, DateTimeOffset, CancellationToken)

Records that a run this user started has been asked to stop, so it composes nothing further.