calternal_plugin_notes::canvas_assets
Home asset preparation for Canvas saves and exports (#989, DESIGN §60). The Files adapter owns identity, authorization and quota. Durable assets precede the Canvas compare-and-swap: interruption keeps the old Canvas intact, or leaves a new Canvas whose assets all exist. Content-derived names make a retry reuse completed assets instead of duplicating them.
Source: crates/plugins/notes/src/canvas_assets.rs
Structs
Section titled “Structs”CanvasAsset
Section titled “CanvasAsset”pub struct CanvasAssetFiles returns bounded bytes only after checking the current item identity.
Fields
pub bytes: Vec<u8>pub mime: String
Source: crates/plugins/notes/src/canvas_assets.rs:13
Traits
Section titled “Traits”CanvasAssets
Section titled “CanvasAssets”pub trait CanvasAssets: Send + SyncBreak the Notes/Files dependency cycle without a second filesystem writer. Save is called only after a real event and the Note’s If-Match check.
CanvasAssets::install
Section titled “CanvasAssets::install”fn install<'a>( &'a self, owner: &'a str, path: &'a RelPath, asset: &'a CanvasAsset, namespace: &'a tokio::sync::MutexGuard<'_, ()>, ) -> Pin<Box<dyn Future<Output = std::result::Result<String, String>> + Send + 'a>>;Install one verified asset without replacing any existing file. The writer holds this namespace guard through the final Canvas commit.
CanvasAssets::read
Section titled “CanvasAssets::read”fn read<'a>( &'a self, viewer: &'a str, canvas_path: &'a str, reference: &'a serde_json::Value, ) -> Pin<Box<dyn Future<Output = std::result::Result<CanvasAsset, String>> + Send + 'a>>;Resolve the ID first; a failed identity never falls back to a name.
Source: crates/plugins/notes/src/canvas_assets.rs:20
Functions
Section titled “Functions”set_canvas_assets
Section titled “set_canvas_assets”pub fn set_canvas_assets(adapter: Arc<dyn CanvasAssets>)Install the one Files adapter at server startup, before routes accept work.