Skip to main content

irontide_session_core/
lib.rs

1#![warn(missing_docs)]
2//! `IronTide` session machinery (base layer; M244c).
3//!
4//! Holds the supporting modules the session orchestrator (`irontide-session`'s
5//! `session.rs`) builds on — registries, queue, resume, apply, persistence,
6//! listeners, and the engine/support re-export shims — so the 12k-LOC
7//! orchestrator compiles independently of this stable base.
8
9// error / i2p / rate_limiter / slot_tuner / stats / transport live in
10// irontide-engine-support (M244b); re-exported at their old crate:: paths so
11// the machinery references resolve zero-churn.
12pub(crate) use irontide_engine_support::error;
13pub use irontide_engine_support::i2p;
14pub(crate) use irontide_engine_support::rate_limiter;
15pub use irontide_engine_support::stats;
16pub use irontide_engine_support::transport;
17// M244b engine/session split: the per-torrent actor + non-leaf infra moved to
18// irontide-engine; re-export the modules the machinery reaches at their old
19// crate:: paths so the moved files resolve zero-churn. `metadata` is the only
20// engine crate-private shim the machinery (metadata_resolver) reaches — the
21// rest (proxy / torrent / peer_state / …) are session.rs's and stay there.
22pub(crate) use irontide_engine::metadata;
23pub use irontide_engine::{
24    alert, disk, disk_backend, extension, hash_pool, streaming, url_guard, verify_before_download,
25};
26
27// --- the session machinery (M244c: descended from irontide-session). All `pub`
28// so irontide-session can re-export them at their old crate:: paths; the sibling
29// narrows visibility per-module to keep its surface byte-stable. ---
30/// Transactional `apply_settings` skeleton with phase-ordered rollback (M173 Lane B).
31pub mod apply;
32/// qBt-compat category registry (M170).
33pub mod category_manager;
34/// TCP/uTP listener polling, extracted from `SessionActor`'s main `select!` loop.
35pub mod listener;
36/// Local Service Discovery (LSD / BEP-14) announce + receive.
37pub mod lsd;
38/// Magnet metadata (BEP-9) resolution for off-actor adds.
39pub mod metadata_resolver;
40/// M226: engine-side OS notification dispatcher
41/// (completion + error toasts via `notify-rust` / zbus).
42pub mod notification;
43/// Session-state persistence: peer-strike / DHT-node / resume snapshot types.
44pub mod persistence;
45/// Torrent queue + auto-management (active/seeding caps, FIFO position).
46pub mod queue;
47/// Shared helpers for TOML-backed user-facing registries (category/tag) — M171.
48pub(crate) mod registry_common;
49/// Resume file persistence: serialize, deserialize, atomic write, and directory helpers.
50pub mod resume_file;
51/// Save-path token expansion (M173 Lane A — Decision 5).
52pub mod save_path;
53/// `Settings` → runtime-config conversions, as a session-local extension trait (M242).
54pub mod settings_convert;
55/// qBt-compat tag registry (M171).
56pub mod tag_manager;
57/// Shared session payload + debug snapshot types.
58pub mod types;
59/// uTP routing helpers shared by the listener + LSD paths.
60pub(crate) mod utp_routing;
61
62// --- flattened re-exports preserved at the old crate:: paths (machinery uses
63// these internally; irontide-session re-exports the public ones for the facade).
64// The session-types line (AddSource/AddTorrentParams/… from session.rs) stays in
65// irontide-session — session.rs did not move. ---
66pub use alert::{Alert, AlertCategory, AlertKind, AlertStream};
67pub use apply::{ApplyError, Phase, ReconfigGuard, ReconfigInFlight, apply_phases_with_rollback};
68pub use category_manager::{
69    CategoryError, CategoryMetadata, CategoryRegistry, resolve_category_registry_path,
70};
71pub use disk::{DiskConfig, DiskHandle, DiskJobFlags, DiskManagerHandle, DiskStats};
72pub use disk_backend::{DisabledDiskIo, DiskIoBackend, DiskIoStats};
73pub use error::{Error, Result};
74pub use extension::ExtensionPlugin;
75pub use hash_pool::{HashJob, HashPool, HashResult};
76pub use i2p::{I2pDestination, I2pDestinationError};
77pub use irontide_core::validate_resume_bitfield;
78pub use irontide_core::{WebSeedState, WebSeedStats};
79pub use irontide_engine::{
80    ChokingAlgorithm, PeerPipelineSnapshot, PeerSource, ProxyConfig, ProxyType,
81    SeedChokingAlgorithm, TorrentHandle, TrackerInfo, TrackerStatus, build_wanted_pieces,
82};
83pub use irontide_session_types::ban::BanConfig;
84pub use irontide_session_types::ip_filter::{
85    IpFilter, IpFilterError, PortFilter, parse_dat, parse_p2p,
86};
87pub use irontide_settings::{
88    DEFAULT_ADMINADMIN_HASH, MaxRatioAction, QbtCompatSettings, QbtCredentialMigration,
89    QbtMigrationError, Settings, SettingsError, hash_qbt_password, migrate_qbt_credentials,
90};
91pub use persistence::{DhtNodeEntry, PeerStrikeEntry, SessionState};
92pub use rate_limiter::MixedModeAlgorithm;
93pub use resume_file::{ResumeFileError, default_resume_dir};
94pub use save_path::{
95    ExpandSavePathError, SimpleContentType, TorrentSavePathContext, expand_save_path_for_category,
96    expand_save_path_template,
97};
98pub use stats::{
99    MetricKind, NUM_METRICS, SessionCounters, SessionStatsMetric, session_stats_metrics,
100};
101pub use streaming::FileStream;
102pub use tag_manager::{TagError, TagRegistry, resolve_tag_registry_path};
103pub use transport::{BoxedStream, NetworkFactory, TransportListener};
104pub use types::{
105    DebugDispatchState, DebugPeerState, DebugState, DebugTorrentState, FileInfo, FileMode,
106    FileStatus, PartialPieceInfo, PeerInfo, SessionStats, StorageFactory, TorrentConfig,
107    TorrentFlags, TorrentInfo, TorrentState, TorrentStats, TorrentSummary,
108};