Google Calendar 00:00:01 A month contains more than stored rows Leena opens her March calendar in London. Design a Google Calendar-style service that can return single events, recurring occurrences and moved exceptions in the user's time zone, while respecting calendar access permissions. A month of one calendar, in the reader's zone. a window is required, so the answer is bounded. Owner, writer, reader or free/busy only. the gateway knows who you are, only the service knows what you may see. Single events and rules that touch January, and exceptions moved into it. Entries, an ETag for repeats, and a token for the next sync. Bound expansion to the requested time window and include exceptions moved into it. A viewer with free-busy access should receive availability without private meeting details. 00:00:56 Move one Monday without rewriting the series The calendar stores a recurrence rule instead of creating a permanent row for every future Monday. To display a month it expands candidate occurrences and then applies cancellations and moves. The database holds one row for the series. Five Mondays fall in March. Two rows match by original start. 16 March is shown on Tuesday, 23 March not at all. An exception needs a stable identity tied to the original occurrence. Its new displayed time is not enough to identify which Monday was edited. 00:01:31 Create the meeting before notifying the guests Leena invites colleagues. A stable meeting identifier lets her retry an uncertain creation request. Commit the event and an outbox record together before asking asynchronous workers to send invitations. The client made the ID, so a repeat after a lost answer makes no second event. Change number, event, change row, outbox row. No occurrence rows. Two sites have confirmed. The user sees the meeting. A small copy in each guest's calendar, mail, and the next reminder only. Guest copies, email and notifications can each retry. Preserve the event identity and change version so a delayed invitation cannot overwrite a later cancellation. 00:02:20 Fourteen hundred in New York moves in UTC The organizer intends a meeting to stay at two in the afternoon New York time. New York and London change clocks on different dates. Following one fixed UTC offset for every occurrence changes the intended local meeting hour. Before the illustrated daylight-saving transition, two in the afternoon in New York corresponds to seven in the evening UTC. After New York changes its offset, the same local meeting time corresponds to six in the evening UTC. London has not yet made its own change. When London also changes, its local display shifts back while the organizer's two o'clock time stays intact. Keep the named time zone and the recurrence's local-time intent. Convert each occurrence using the applicable zone rules, and specify how ambiguous or nonexistent local times are handled. 00:03:13 Remind at the right moment after an edit A calendar spanning years needs a reminder scheduler that can recover after a worker dies. Keeping a bounded horizon of upcoming reminders avoids expanding every future recurrence in advance. Only the next reminder of every event is a row. A lease of ten seconds. another planner may not take it, unless this one dies. Done, and the next date is written. The provider accepted it. The phone drops a repeat by ID. Before sending, check the event version and current reminder settings. A timer that fired exactly on time can still be wrong after the host rescheduled or cancelled the meeting.