Table of Contents

Method RecordSettingsAsync

Namespace
MailFathom.Infrastructure.Persistence.Users
Assembly
MailFathom.Infrastructure.dll

RecordSettingsAsync(Guid, long, Func<GoverningSettingsPolicies, MailAccountQueryableSettings?>, CancellationToken)

Records the settings an account is served on, where the account still stands at the version they were read from.

Task<bool> RecordSettingsAsync(Guid accountId, long readFrom, Func<GoverningSettingsPolicies, MailAccountQueryableSettings?> derive, CancellationToken cancellationToken)

Parameters

accountId Guid

The account.

readFrom long

The version of the document the settings came from.

derive Func<GoverningSettingsPolicies, MailAccountQueryableSettings>

Derives the settings under the policies that govern the account, or answers null to record nothing. It is called inside the write's transaction and performs no I/O of its own.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<bool>

Whether they were recorded; an account that moved on, or is gone, records nothing.

Remarks

Every write of this build records them with the document; this is for a row a build older than the settings columns wrote alone. The settings are derived under the lock a policy write excludes record writes with, so a policy that lands while a row is being read again is either the one the row is derived from or the one that rewrites it afterwards.

Exceptions

ArgumentNullException

Thrown when derive is null.