Skip to content

calternal_dav::protocol

Virtual DAV collections. Paths select a user’s provider; they are never converted to filesystem paths. The server supplies authenticated identity. Log DELETE delegates child re-parenting to Notes; transfer hints restore only the deleted line, never its retained children (#471; DESIGN §46 A7). Every request XML tree uses the shared bounded reader first; byte limits alone do not bound tree depth or decoded allocation (#785, DESIGN §21).

Source: crates/calternal-dav/src/protocol.rs

pub struct CalendarCollectionPatch

Validated updates for the writable Apple collection properties.

Fields

  • pub color: PropertyUpdate<String>
  • pub order: PropertyUpdate<u32>

Implements: Clone, Debug, Default, PartialEq, Eq

Source: crates/calternal-dav/src/protocol.rs:270

pub struct CalendarCollectionProperties

The values that Apple Calendar reads from an owned collection.

Fields

  • pub color: String: Always an opaque sRGB colour in #RRGGBB form.
  • pub order: u32: Apple uses this integer to order calendars in its sidebar.

Implements: Clone, Debug, PartialEq, Eq

Source: crates/calternal-dav/src/protocol.rs:241

pub struct DavIdentity

Identity is supplied by the server middleware, never by a DAV XML value.

Fields

  • pub user: String
  • pub data_scope: bool

Implements: Clone

Source: crates/calternal-dav/src/protocol.rs:669

pub struct DavState

No doc comment.

Fields

  • pub journal: Arc<dyn JournalProvider>
  • pub reminders: Arc<dyn RemindersProvider>
  • pub external: Arc<dyn ExternalCalendarsProvider>
  • pub collection_properties: Arc<dyn CalendarCollectionPropertiesProvider>

Implements: Clone

Source: crates/calternal-dav/src/protocol.rs:314

pub struct JournalChanges

No doc comment.

Fields

  • pub cursor: i64
  • pub token: String
  • pub items: Vec<(String, bool)>

Source: crates/calternal-dav/src/protocol.rs:216

pub struct ReminderChanges

No doc comment.

Fields

  • pub cursor: i64
  • pub token: String
  • pub items: Vec<(String, bool)>: Resource additions and tombstones since a prior cursor.
  • pub initial_resources: Option<Vec<ReminderTask>>: Full resource snapshot for an initial sync. In this case items is empty. The DAV handler uses these rows to build the response without issuing one get per UID.

Source: crates/calternal-dav/src/protocol.rs:222

pub enum DavError

No doc comment.

Variants

  • NotFound
  • Conflict
  • Precondition
  • Invalid
  • InvalidSyncToken
  • InsufficientStorage
  • ServiceUnavailable
  • Internal

Implements: Clone, Copy, Debug

Source: crates/calternal-dav/src/protocol.rs:34

pub enum PropertyUpdate<T>

One field update in an atomic collection-property patch.

Variants

  • Keep: Leave the current value unchanged.
  • Set(T): Store a new value.
  • Remove: Remove the override and use the collection default.

Implements: Clone, Debug, Default, PartialEq, Eq

Source: crates/calternal-dav/src/protocol.rs:258

pub trait CalendarCollectionPropertiesProvider: Send + Sync

The server adapter stores these client display properties in User settings. collection is a stable identity, not a display name or filesystem path. Area calendars can use their normalized area/<tag> identity here.

CalendarCollectionPropertiesProvider::read

Section titled “CalendarCollectionPropertiesProvider::read”
fn read<'a>(
&'a self,
user: &'a str,
collection: &'a str,
) -> ProviderFuture<'a, CalendarCollectionProperties>;

No doc comment.

CalendarCollectionPropertiesProvider::read_many

Section titled “CalendarCollectionPropertiesProvider::read_many”
fn read_many<'a>(
&'a self,
user: &'a str,
collections: &'a [String],
) -> ProviderFuture<'a, Vec<CalendarCollectionProperties>>

Read all properties for a calendar-home listing on one User settings snapshot. The default keeps replay providers small; the server adapter overrides it to avoid one filesystem read per area.

CalendarCollectionPropertiesProvider::update

Section titled “CalendarCollectionPropertiesProvider::update”
fn update<'a>(
&'a self,
user: &'a str,
collection: &'a str,
patch: CalendarCollectionPatch,
) -> ProviderFuture<'a, ()>;

No doc comment.

Source: crates/calternal-dav/src/protocol.rs:281

pub trait ExternalCalendarsProvider: Send + Sync

#40 will provide the derived external calendar cache and provider writes. Keeping it separate ensures Journal writes never enter that cache.

fn names<'a>(&'a self, user: &'a str) -> ProviderFuture<'a, Vec<String>>;

No doc comment.

Source: crates/calternal-dav/src/protocol.rs:235

pub trait JournalProvider: Send + Sync

The Notes plugin implements these calls with conditional calternal-fs writes. list must include an identity for every projected Log entry.

fn list<'a>(&'a self, user: &'a str) -> ProviderFuture<'a, Vec<JournalEvent>>;

No doc comment.

fn deleted_copy<'a>(
&'a self,
_user: &'a str,
_target_collection: &'a str,
_requested_id: &'a str,
_event: &'a JournalEvent,
) -> ProviderFuture<'a, Option<JournalEvent>>

Find a recently deleted source after a server restart between Apple’s DELETE and PUT move requests. Providers without durable intents may use the process-local transfer hint in this protocol.

fn clear_deleted_copy<'a>(&'a self, _user: &'a str, _id: &'a str) -> ProviderFuture<'a, ()>

Remove a consumed durable transfer hint. A failed cleanup must not turn an already committed Log write into a failed DAV response.

fn get_copy<'a>(
&'a self,
user: &'a str,
collection: &'a str,
tag: Option<&'a str>,
copy_id: &'a str,
) -> ProviderFuture<'a, JournalEvent>

Find one projected copy without requiring a full Daily note scan. Providers with a resource Index override this default replay path.

fn area_tags<'a>(&'a self, user: &'a str) -> ProviderFuture<'a, Vec<String>>

All area tags present in the User’s Home, including areas with no Log entries. The tag Index is rebuildable; it supplies this catalog.

fn changes<'a>(
&'a self,
user: &'a str,
since: Option<&'a str>,
) -> ProviderFuture<'a, JournalChanges>;

No doc comment.

fn sync_token<'a>(&'a self, user: &'a str) -> ProviderFuture<'a, String>

Read the current collection token without materializing every resource. Providers that lack a cursor store can keep the default implementation; indexed providers should override it for collection discovery (#573).

fn list_area<'a>(
&'a self,
user: &'a str,
tag: Option<&'a str>,
ids: Option<&'a std::collections::HashSet<String>>,
) -> ProviderFuture<'a, Vec<JournalEvent>>

Read one area projection, optionally limited to resource IDs in a delta. The default keeps existing providers correct; persistent providers can use their area and resource indexes to avoid a Home-wide read (#573).

fn list_area_copies<'a>(
&'a self,
user: &'a str,
collection: &'a str,
tag: Option<&'a str>,
ids: &'a std::collections::HashSet<String>,
) -> ProviderFuture<'a, Vec<JournalEvent>>

Resolve area copy IDs for calendar-multiget. Copy IDs are stable DAV identities that differ from the source Log block IDs used by sync. Providers with an alias index can avoid listing the full area.

fn get<'a>(&'a self, user: &'a str, id: &'a str) -> ProviderFuture<'a, JournalEvent>;

No doc comment.

fn put<'a>(
&'a self,
user: &'a str,
id: &'a str,
event: JournalEvent,
if_match: Option<&'a str>,
if_none_match: bool,
) -> ProviderFuture<'a, JournalEvent>;

No doc comment.

fn delete<'a>(
&'a self,
user: &'a str,
id: &'a str,
if_match: &'a str,
) -> ProviderFuture<'a, ()>;

No doc comment.

Source: crates/calternal-dav/src/protocol.rs:47

pub trait RemindersProvider: Send + Sync

The Notes plugin implements Task reads and writes against Markdown. All identities and ETags are derived from the current task projection and its complete source bytes.

fn list<'a>(&'a self, user: &'a str) -> ProviderFuture<'a, Vec<ReminderTask>>;

No doc comment.

fn sync_token<'a>(&'a self, user: &'a str) -> ProviderFuture<'a, String>;

Return the collection token without reading every Task resource.

fn changes<'a>(
&'a self,
user: &'a str,
since: Option<&'a str>,
) -> ProviderFuture<'a, ReminderChanges>;

No doc comment.

fn get<'a>(&'a self, user: &'a str, id: &'a str) -> ProviderFuture<'a, ReminderTask>;

No doc comment.

fn put<'a>(
&'a self,
user: &'a str,
id: &'a str,
task: ReminderTaskEdit,
if_match: Option<&'a str>,
if_none_match: bool,
) -> ProviderFuture<'a, ReminderTask>;

No doc comment.

fn delete<'a>(
&'a self,
user: &'a str,
id: &'a str,
if_match: &'a str,
) -> ProviderFuture<'a, ()>;

No doc comment.

Source: crates/calternal-dav/src/protocol.rs:190

pub type ProviderFuture<'a, T> = Pin<Box<dyn Future<Output = Result<T, DavError>> + Send + 'a>>;

No doc comment.

Source: crates/calternal-dav/src/protocol.rs:31

pub fn normalize_dav_calendar_color(value: &str) -> Option<String>

Normalize the RGB or RGBA hex value used by Apple to opaque #RRGGBB.

Source: crates/calternal-dav/src/protocol.rs:544

pub fn router(state: DavState) -> Router

Expose DAV resources and redirect discovery requests to /dav/ (#908). The server must install DavIdentity after credential validation. Handlers require Authorization and data scope; a browser cookie alone does not grant DAV access (DESIGN §14, §30).

Source: crates/calternal-dav/src/protocol.rs:678

pub const DEFAULT_CALENDAR_COLOR: &str

The default accent for the default Paper theme.

Source: crates/calternal-dav/src/protocol.rs:276