Table of Contents

Class CalendarFileImport

Namespace
MailFathom.Application.Calendar.Import
Assembly
MailFathom.Application.dll

Puts the events of an iCalendar file the signed-in person chose onto their own calendar.

public sealed class CalendarFileImport
Inheritance
CalendarFileImport
Inherited Members

Remarks

Reading a file is not synchronizing against a calendar server. Nothing is subscribed to, nothing is polled, and nothing is written back: the octets are read once, the events they name are written, and the file is then no part of this deployment's record. What the events keep of it is the identifier each entry named itself by, and that is kept for exactly one question — has this been imported here already.

A person sees the count before anything is written. SummariseAsync(Stream, CancellationToken) and ImportAsync(Stream, CancellationToken) read the same file the same way and answer in the same terms; the first writes nothing, and the second is what the person's confirmation performs. That is the acceptance an imported event rests on rather than a courtesy, because a file somebody else prepared is exactly the case where what is about to be created is not obvious from having chosen it. The two counts differ only where the calendar moved between them — the same file imported elsewhere in the meantime — and then the confirmation's own count is the true one, because it is taken in the attempt that committed.

The zone an entry naming none of its own is read in is the person's own recorded zone. RFC 5545 defines a floating time as the local time of whoever reads it, and an all-day entry states a date whose day opens at a different instant in every zone — so both need a zone this deployment supplies, and the one it supplies is the one the person's record states rather than one the request carried. A request could state a zone nobody chose, and a file opened on a second machine would then land on a different day than the same file opened on the first.

The confirmation carries the file again rather than a token. Nothing is staged between the two acts, so there is no half-import to expire, to clean up, or to leave an entry of somebody's day sitting in this deployment while they decide. The cost is one more upload of a file already bounded at MaximumFileBytes, which is the cheaper half of that trade by a wide margin.

An import is one transaction. Either the calendar holds every event the confirmed summary named or it holds none of them, so a file that fails part way through leaves nothing behind for a person to find and undo by hand.

Constructors

CalendarFileImport(AccessAuthorization, ICalendarFileReader, ICalendarEventStore, IUserTimeZones, OptimisticConcurrencyRetryPolicy, TimeProvider)

Initializes the use case.

Fields

MaximumEntryCount

The most entries one import writes.

MaximumFileBytes

The largest file an import reads.

Methods

ImportAsync(Stream, CancellationToken)

Puts the events of a file the acting person confirmed onto their own calendar.

SummariseAsync(Stream, CancellationToken)

Reports what a file would put on the acting person's calendar, writing nothing.