calternal_collab::canvas
Whole-element Canvas events for the server’s Yrs document (DESIGN §60, #976).
Clients submit elements, not Yrs structs. Only the authenticated server transaction writes the map, so client IDs cannot override the Excalidraw version/nonce rule or spoof the author. Image bytes stay in Home files or unchanged legacy source, outside this map and the later update log (#989).
Source: crates/calternal-collab/src/canvas.rs
Functions
Section titled “Functions”apply_elements
Section titled “apply_elements”pub fn apply_elements(doc: &Doc, base: &Value, updates: &[Value], author: &str) -> Result<bool>Validate an entire event before one author-bound transaction changes the map. A stale update is a no-op. Deletion uses a tombstone, never map removal.
Source: crates/calternal-collab/src/canvas.rs:144
elements
Section titled “elements”pub fn elements(doc: &Doc) -> Result<Vec<Value>>Read whole values in fractional index order with ID as a deterministic tie.
Source: crates/calternal-collab/src/canvas.rs:94
from_scene
Section titled “from_scene”pub fn from_scene(scene: &Value) -> Result<Doc>Build the rebuildable room state. Unknown scene and image fields stay on disk.
Source: crates/calternal-collab/src/canvas.rs:22
Constants
Section titled “Constants”ELEMENTS
Section titled “ELEMENTS”pub const ELEMENTS: &strStable map name used by every Canvas client.
Source: crates/calternal-collab/src/canvas.rs:14
MAX_EVENT_BYTES
Section titled “MAX_EVENT_BYTES”pub const MAX_EVENT_BYTES: usizeSmaller than Notes frames because Canvas updates never carry image bytes.
Source: crates/calternal-collab/src/canvas.rs:18
MESSAGE_CANVAS_ELEMENTS
Section titled “MESSAGE_CANVAS_ELEMENTS”pub const MESSAGE_CANVAS_ELEMENTS: u8The one accepted Canvas event kind. Its author is supplied by the connection.
Source: crates/calternal-collab/src/canvas.rs:454
pub const META: &strShared, portable Canvas settings; view state stays local to each Installation.