Table of Contents

Class ClientSignals

Namespace
MailFathom.Application.Signals
Assembly
MailFathom.Application.dll

The one place a signal is raised, folded, and handed to every registered channel.

public sealed class ClientSignals : IAsyncDisposable
Inheritance
ClientSignals
Implements
Inherited Members

Remarks

Raising is the caller's whole obligation and it never fails: the work a signal describes is already committed by the time one is raised, so a delivery that could not happen is the client's own interval to close rather than a reason to fail a synchronization run. Publish(ClientSignal) therefore returns without awaiting anything.

Signals are folded per scope over a short window. A run that commits forty messages into one folder is one arrival to the person who was away from the screen, exactly as it is one notification, so the statements are held for FoldingWindow and the fold is what a channel is handed. The scope is the user, the kind, and the place, so two folders' arrivals stay two statements — folding them into one would leave a client told that mail arrived without being told where to look.

The window is measured against an injected TimeProvider, so a test decides it rather than waiting it out, and DrainAsync() is how a caller — a test, or this type's own disposal — waits for what a tick started.

A deployment with no channel registered buffers nothing at all and starts no timer, which is what keeps a service serving no client from holding state about signals nobody can receive.

Constructors

ClientSignals(IEnumerable<IClientSignalChannel>, TimeProvider)

Initializes the publisher over whatever channels this deployment registered.

Fields

FoldingWindow

How long statements about one scope are held before the fold of them is delivered.

MostFoldedScopes

The most scopes held at once before a further one is delivered unfolded.

Properties

Reaches

Gets whether anything is registered to deliver a signal, which is what makes raising one worth the fold.

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

DrainAsync()

Waits for whatever the last elapsed window started to have been delivered.

Publish(ClientSignal)

Says that something changed, without waiting for anyone to be told.