Skip to content

calternal_plugin::timing

Cheap request phase timing for Calendar, Notes and Files (#549).

The task-local counters hold no User data. Timed blocks must not overlap: db, fs, parse and lock measure selected operations, while total includes plugin routing, uninstrumented work and response serialization. Common session and access middleware runs before this scope and is not in total. Streaming bodies are also outside it. A missing phase is omitted, so the header never claims that an unmeasured operation is free.

Source: crates/calternal-plugin/src/timing.rs

pub struct Interval

One phase interval. Drop records it even when its operation returns an error.

Implements: Drop

Source: crates/calternal-plugin/src/timing.rs:35

pub enum Phase

Non-overlapping server work categories used by the #549 waterfall.

Variants

  • Db: Index query and pool wait.
  • Fs: Directory-handle-relative file access.
  • Parse: Parsing or recurrence projection in memory.
  • Lock: Wait for a per-User writer guard; stops before the guarded work starts.

Implements: Clone, Copy

Source: crates/calternal-plugin/src/timing.rs:23

pub async fn middleware(request: Request, next: Next) -> Response

Add bounded numeric Server-Timing values without changing status or body. Streaming response bodies are not consumed: total ends when headers are ready.

Source: crates/calternal-plugin/src/timing.rs:63

pub fn phase(phase: Phase) -> Interval

Start a selected operation; outside a timed request this performs no clock read.

Source: crates/calternal-plugin/src/timing.rs:41