Table of Contents

Interface IContactDirectory

Namespace
MailFathom.Application.Contacts
Assembly
MailFathom.Application.dll

Reads what one user's books hold: one person by identity or by an address they use, a set of them by identity or by name, and a page of the whole.

public interface IContactDirectory

Remarks

Every read names the scope it is answering about, and a scope is one user's: their own book and the collected book of each account assigned to them. An identity, an address, or a name that belongs to a book outside it is answered as one nobody holds, which is the same answer the reader would have got before anybody wrote it down. The reads that would otherwise walk the table lead with the book in the index they are answered from — the address lookup and the listing — while the identity lookups carry the scope as a predicate beside the key they were already seeking on.

One person is answered once, from the first book of the scope that holds them. Two books may hold a person under one address — the user wrote somebody down that a mailbox had already collected, or two of their mailboxes each collected the same correspondent — and every read here hides the later record rather than serving both. What "later" means is ContactBookScope's order and nothing else, so a listing and a name match never disagree about which of the two exists.

That precedence is taken over the record on every read but FindByAddressAsync(ContactBookScope, EmailAddress, CancellationToken), which takes it over the address: a caller there holds the address already, so the earliest book holding that address answers even where a listing hides that record for a different address of the same person. An identity that read hands back is therefore not one the record-level reads are obliged to answer for, and a caller that needs a record the whole surface agrees on reads the person rather than the address.

The hiding happens in the query rather than over a page already read, so a page still holds exactly the size asked for while the walk has more to serve, and a short page means the walk is over. Reading to the end of the book is asking for pages until one carries no cursor, exactly as it was before.

Every read joins no transaction and returns complete contacts rather than an entity graph, which is why it is a port of its own beside IContactStore rather than a set of methods on it. Every lookup is answered from an index rather than from a scan, and the page is bounded and ordered so a walk of the book terminates.

Methods

FindAllAsync(ContactBookScope, IReadOnlyCollection<ContactId>, CancellationToken)

Reads several contacts by the identities the book gave them.

FindAsync(ContactBookScope, ContactId, CancellationToken)

Reads one contact by the identity the book gave it.

FindByAddressAsync(ContactBookScope, EmailAddress, CancellationToken)

Reads the person who uses one address.

FindHeldAddressesAsync(ContactBookScope, IReadOnlyCollection<EmailAddress>, CancellationToken)

Reads which of the given addresses some contact the scope shows already holds.

FindHoldersOfAsync(ContactBookHolder, IReadOnlyCollection<EmailAddress>, CancellationToken)

Reads which contacts of one book already hold each of the given addresses.

MatchDisplayNamesAsync(ContactBookScope, IReadOnlyCollection<ContactDisplayName>, CancellationToken)

Reads who each name resolves to, by the whole of that name rather than by part of it.

ReadPageAsync(ContactBookScope, ContactQuery, CancellationToken)

Reads one bounded page of the books a scope reads.