Skip to content

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

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

pub struct TagAssignment

No doc comment.

Fields

  • pub path: String
  • pub tags: Vec<String>

Implements: Clone, Debug, Deserialize, Serialize, ToSchema

Source: crates/calternal-tags/src/lib.rs:229

pub struct TagAssignmentsPage

One 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

pub struct TagCount

One tag and the number of distinct tagged objects below it in the hierarchy.

Fields

  • pub tag: String
  • pub count: u64

Implements: Clone, Debug, Deserialize, Serialize, ToSchema

Source: crates/calternal-tags/src/lib.rs:206

pub struct TagItem

One tagged object in a Home.

Fields

  • pub kind: String
  • pub id: String
  • pub path: String
  • pub title: Option<String>

Implements: Clone, Debug, Deserialize, Serialize, ToSchema

Source: crates/calternal-tags/src/lib.rs:213

pub struct TagPage

No doc comment.

Fields

  • pub tag: String
  • pub items: Vec<TagItem>
  • pub next_cursor: Option<usize>

Implements: Clone, Debug, Deserialize, Serialize, ToSchema

Source: crates/calternal-tags/src/lib.rs:222

pub enum Error

No doc comment.

Variants

  • InvalidPath
  • InvalidTag
  • InvalidMetadata
  • InvalidXmp
  • InvalidMarkdown
  • NoSources
  • ConfirmationRequired
  • RenamePending
  • ConcurrentChange
  • Filesystem(calternal_fs::Error)
  • Database(sqlx::Error)

Implements: Debug, std::fmt::Display, std::error::Error

Source: crates/calternal-tags/src/lib.rs:46

pub type Result<T> = std::result::Result<T, Error>;

No doc comment.

Source: crates/calternal-tags/src/lib.rs:39

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

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

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

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

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

pub fn is_folder_metadata_path(path: &str) -> bool

Check whether a Home path is the server-owned folder metadata file.

Source: crates/calternal-tags/src/lib.rs:451

pub fn migrations() -> MigrationSet

No doc comment.

Source: crates/calternal-tags/src/lib.rs:279

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

pub fn prepare_markdown_index(path: &str, text: &str) -> PreparedMarkdownIndex

Parse 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

pub fn prepare_note_projection(
path: &str,
source: &str,
id: &str,
tags: Vec<String>,
) -> PreparedMarkdownIndex

Prepare 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

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

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

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

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

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

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.

Source: crates/calternal-tags/src/lib.rs:440