Table of Contents

Interface IMailAccountRecordStore

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

Reads and writes the mail accounts a deployment holds and the users each is assigned to.

public interface IMailAccountRecordStore

Remarks

Every write that changes what a user is served also moves that user's record version in the same transaction. The user a replica serves is composed from their record and the accounts assigned to them, and a replica learns that it has to compose them again by the record's version moving — so a write that left the version where it was would change a mailbox no replica holding that user ever composed again.

Methods

AssignAsync(Guid, UserId, long, CancellationToken)

Assigns an account to one more user, where the two belong to the same organization or both to none and the account is assigned to fewer users than MaximumUsersAssignedIn(Guid?) admits where it belongs.

CreateAsync(UserId, long, Func<GoverningSettingsPolicies, MailAccountCandidate?>, CancellationToken)

Creates an account in the organization of the user it is created for, and assigns it to them.

EraseAsync(Guid, CancellationToken)

Erases an account, every assignment to it, and everything stored for it.

ReadAsync(Guid, CancellationToken)

Reads one account and the users it is assigned to.

ReadPageAsync(AdministrativeListingQuery, IReadOnlySet<AssignmentScope>, CancellationToken)

Reads one page of the accounts some scopes cover, with the users each is assigned to.

ReadSolelyAssignedAsync(UserId, CancellationToken)

Reads the accounts one user is assigned and nobody else is.

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.

SaveAsync(Guid, long, Func<GoverningSettingsPolicies, MailAccountCandidate?>, CancellationToken)

Replaces an account's address, name, and settings where it still stands at the version they were composed over.

UnassignAsync(Guid, UserId, CancellationToken)

Ends one user's assignment to an account, erasing the account and its mail when nobody else is assigned it.