calternal-tags
One rebuildable tag Index over the Markdown, XMP, and folder metadata sources.
File writes stay next to their content. This Plugin owns only the shared lookup and journal; Notes and Files call the small source hooks after writes. Tag pages read Note and Task titles from their Notes-owned projections so the UI can avoid exposing source paths and filenames (#1109, DESIGN §33). Files also use bounded exact-path assignment reads for current-view filters (#1109). Every rename entry point queues the same durable worker and exact Undo journal; the legacy route grants no separate write path (#1110, DESIGN §41).
Source: crates/calternal-tags/src/lib.rs
Structs
Section titled “Structs”PreparedMarkdownIndex
Section titled “PreparedMarkdownIndex”pub struct PreparedMarkdownIndex(index::PreparedMarkdownIndex);Parsed tag rows for a Markdown source, ready to stage in a writer transaction.
Implements: Clone, Debug
Source: crates/calternal-tags/src/lib.rs:43
TagAssignment
Section titled “TagAssignment”pub struct TagAssignmentNo doc comment.
Fields
pub path: Stringpub tags: Vec<String>
Implements: Clone, Debug, Deserialize, Serialize, ToSchema
Source: crates/calternal-tags/src/lib.rs:229
TagAssignmentsPage
Section titled “TagAssignmentsPage”pub struct TagAssignmentsPageOne page of file and Photo assignments below a folder.
Fields
pub assignments: Vec<TagAssignment>pub next_cursor: Option<usize>
Implements: Clone, Debug, Deserialize, Serialize, ToSchema
Source: crates/calternal-tags/src/lib.rs:236
TagCount
Section titled “TagCount”pub struct TagCountOne tag and the number of distinct tagged objects below it in the hierarchy.
Fields
pub tag: Stringpub count: u64
Implements: Clone, Debug, Deserialize, Serialize, ToSchema
Source: crates/calternal-tags/src/lib.rs:206
TagItem
Section titled “TagItem”pub struct TagItemOne tagged object in a Home.
Fields
pub kind: Stringpub id: Stringpub path: Stringpub title: Option<String>
Implements: Clone, Debug, Deserialize, Serialize, ToSchema
Source: crates/calternal-tags/src/lib.rs:213
TagPage
Section titled “TagPage”pub struct TagPageNo doc comment.
Fields
pub tag: Stringpub items: Vec<TagItem>pub next_cursor: Option<usize>
Implements: Clone, Debug, Deserialize, Serialize, ToSchema
Source: crates/calternal-tags/src/lib.rs:222
pub enum ErrorNo doc comment.
Variants
InvalidPathInvalidTagInvalidMetadataInvalidXmpInvalidMarkdownNoSourcesConfirmationRequiredRenamePendingConcurrentChangeFilesystem(calternal_fs::Error)Database(sqlx::Error)
Implements: Debug, std::fmt::Display, std::error::Error
Source: crates/calternal-tags/src/lib.rs:46
Type aliases
Section titled “Type aliases”Result
Section titled “Result”pub type Result<T> = std::result::Result<T, Error>;No doc comment.
Source: crates/calternal-tags/src/lib.rs:39
Functions
Section titled “Functions”complete_trash
Section titled “complete_trash”pub async fn complete_trash(db: &Db, user: &str, path: &str, trash_name: &str) -> Result<()>Complete a server-managed Trash after Files has recorded its Trash name.
Source: crates/calternal-tags/src/lib.rs:434
copy_file_metadata
Section titled “copy_file_metadata”pub async fn copy_file_metadata( root: &Root, db: &Db, user: &str, source_path: &str, target_path: &str, replace: bool,) -> Result<()>Copy file tags after Files has copied content and indexed the destination.
Source: crates/calternal-tags/src/lib.rs:413
empty_trash
Section titled “empty_trash”pub async fn empty_trash(db: &Db, user: &str) -> Result<()>Forget Trash tag snapshots after Files permanently empties the Trash.
Source: crates/calternal-tags/src/lib.rs:446
index_markdown
Section titled “index_markdown”pub async fn index_markdown(db: &Db, user: &str, path: &str, text: &str) -> Result<()>Update the shared Index after the Notes Plugin writes Markdown.
Source: crates/calternal-tags/src/lib.rs:353
index_prepared_markdown_in_transaction
Section titled “index_prepared_markdown_in_transaction”pub async fn index_prepared_markdown_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Sqlite>, user: &str, prepared: &PreparedMarkdownIndex,) -> Result<()>Stage prepared tag rows with the caller’s Index transaction.
This keeps the Notes Task and shared Tags projections in one commit without holding the SQLite writer lock while parsing Markdown.
Source: crates/calternal-tags/src/lib.rs:381
is_folder_metadata_path
Section titled “is_folder_metadata_path”pub fn is_folder_metadata_path(path: &str) -> boolCheck whether a Home path is the server-owned folder metadata file.
Source: crates/calternal-tags/src/lib.rs:451
migrations
Section titled “migrations”pub fn migrations() -> MigrationSetNo doc comment.
Source: crates/calternal-tags/src/lib.rs:279
move_file_metadata
Section titled “move_file_metadata”pub async fn move_file_metadata( root: &Root, db: &Db, user: &str, source_path: &str, target_path: &str, replace: bool,) -> Result<()>Move tags with a file or folder after Files completes its data-directory move.
Source: crates/calternal-tags/src/lib.rs:395
prepare_markdown_index
Section titled “prepare_markdown_index”pub fn prepare_markdown_index(path: &str, text: &str) -> PreparedMarkdownIndexParse a Markdown source before opening a caller-owned writer transaction.
Notes prepares a Daily Journal here, then stages its tag rows alongside the Task projection. Markdown parsing stays outside the SQLite writer lock.
Source: crates/calternal-tags/src/lib.rs:361
prepare_note_projection
Section titled “prepare_note_projection”pub fn prepare_note_projection( path: &str, source: &str, id: &str, tags: Vec<String>,) -> PreparedMarkdownIndexPrepare Tags for a structured Note such as Canvas (DESIGN §60, #976). The caller supplies its stable Note ID and visible Tags. Hash the real source bytes, and never infer a Task from drawing text or scene JSON.
Source: crates/calternal-tags/src/lib.rs:368
prepare_trash
Section titled “prepare_trash”pub async fn prepare_trash(root: &Root, db: &Db, user: &str, path: &str) -> Result<()>Save and remove an object’s folder tags before Files moves it to Trash.
Source: crates/calternal-tags/src/lib.rs:429
reconcile_all
Section titled “reconcile_all”pub async fn reconcile_all(root: &Root, db: &Db) -> Result<()>Rebuild all tag rows from Home source files before routes start serving.
Source: crates/calternal-tags/src/lib.rs:300
reconcile_user
Section titled “reconcile_user”pub async fn reconcile_user(root: &Root, db: &Db, user: &str) -> Result<()>Rebuild one user’s tag rows from source files.
Source: crates/calternal-tags/src/lib.rs:305
recover
Section titled “recover”pub async fn recover(root: &Root, db: &Db) -> Result<()>Admit old saved intents to the durable queue before serving routes (#1110). Already changed legacy bytes have no journal; new batches always retain one.
Source: crates/calternal-tags/src/lib.rs:311
remove_path
Section titled “remove_path”pub async fn remove_path(db: &Db, user: &str, path: &str) -> Result<()>Remove tag rows after the Notes Plugin trashes a Note.
Source: crates/calternal-tags/src/lib.rs:390
restore_trash
Section titled “restore_trash”pub async fn restore_trash(root: &Root, db: &Db, user: &str, path: &str) -> Result<()>Restore the folder metadata and rebuild the affected user’s tag Index.