Method ReadAsync
- Namespace
- MailFathom.Application.Discovery.Streaming
- Assembly
- MailFathom.Application.dll
ReadAsync(DiscoveryRunId, UserId, long, DateTimeOffset, CancellationToken)
Reads a run this user started, from a stated point, and records that it was read.
Task<DiscoveryRunReading?> ReadAsync(DiscoveryRunId id, UserId user, long afterSequence, DateTimeOffset now, CancellationToken cancellationToken)
Parameters
idDiscoveryRunIdThe run the caller is reading.
userUserIdThe user the caller was admitted for.
afterSequencelongThe last sequence the caller already holds, or
0to read the run from its beginning.nowDateTimeOffsetThe instant of the read, which the retention window is measured from.
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<DiscoveryRunReading>
The run's standing and everything after that point, or null where this user has no such run.
Remarks
A sequence this run has not reached reads as the beginning rather than as a point to wait at, which is the safe direction: no client can hold one honestly, so what such a value means is a cursor belonging to some other run, and replaying costs a few events where honouring it would hand back a run missing everything before the number. A run belonging to somebody else is reported as no such run, exactly as one that never existed is.