Skip to main content

Module save_path

Module save_path 

Source
Expand description

Save-path token expansion (M173 Lane A — Decision 5). Save-path token expansion (M173 Lane A — Decision 5).

Implements the locked five-token grammar that expands the on-disk CategoryRegistry save_path template into a concrete download directory at torrent-add time. The grammar is intentionally small and frozen: additions go through a separate plan (and a separate version bump). qBt-parity is the design constraint.

§Grammar

TokenSourceExample
{category}CategoryRegistry lookup of the named categoryLinux
{tracker}TorrentSavePathContext::primary_tracker_host() (lowercased hostname)archlinux.org
{yyyy}UTC year of TorrentSavePathContext::added_at2026
{mm}UTC two-digit month of TorrentSavePathContext::added_at04
{content_type}TorrentSavePathContext::classified_content_type()Audio

Unknown tokens return ExpandSavePathError::UnknownToken — never a silent literal pass-through, never an empty string. This is the [REGRESSION CRITICAL] failure-mode test pinned in the master plan “Required test coverage” section.

§Lane purity

This module is the only addition Lane A makes inside irontide-session. It is invisible to apply_settings, never spins up any actor, never mutates session state, and exposes no async API. The session crate’s public surface gains:

See the master plan Decision 5 for the rationale (eng-review §1: the session owns CategoryRegistry + the global download_dir, so token expansion lives in irontide-session rather than a new crate or the GUI).

Structs§

TorrentSavePathContext
Per-torrent context used to expand {tracker} / {yyyy} / {mm} / {content_type} tokens.

Enums§

ExpandSavePathError
Errors from save-path expansion.
SimpleContentType
Coarse content-type classification surfaced as {content_type}.

Functions§

expand_save_path_for_category
Convenience wrapper that pulls the save_path template out of a CategoryRegistry then delegates to expand_save_path_template.
expand_save_path_template
Expand the five locked tokens inside template against ctx.