Skip to main content

hya_core/
lib.rs

1// Copyright (C) 2026 Javad Rajabzadeh
2// SPDX-License-Identifier: MIT OR Apache-2.0
3//
4// This library is intentionally permissive, not GPL, even though the `hydra`
5// binary that ships it is GPL-3.0-or-later: Rust links statically, so copyleft
6// here would propagate to every downstream crate. See LICENSING.md.
7
8//! HYDRA scheduler core: multi-source download scheduler state machine
9//! with no I/O dependencies.
10//!
11//! Key principles:
12//! * **Dynamic range partitioning**: HTTP byte ranges are tracked client-side,
13//!   allowing slow or stalled connections to be repartitioned and assigned to
14//!   faster connections dynamically.
15//! * **Liveness**: every reachable state has an enabled transition that
16//!   decreases remaining work within a bounded window.
17//! * **Safety**: byte coverage invariants are strictly verified without gaps
18//!   or duplicate allocations.
19//!
20//! Safety (`coverage_holds`) and liveness (`liveness_holds`) properties are
21//! both verified through property-based testing.
22
23#![forbid(unsafe_code)]
24
25pub mod admission;
26pub mod detect;
27pub mod format;
28pub mod intervals;
29pub mod ramp;
30pub mod sched;
31
32pub use admission::{Admission, Admit, DeltaEstimator};
33pub use detect::{CollapseDetector, Health};
34pub use format::{
35    catalogue, describe, detect_format, from_extension as from_extension_pub, known_extensions,
36    Category, Detection, Evidence, Format,
37};
38pub use intervals::{IntervalSet, Range};
39pub use ramp::{ConcurrencyRamp, Ramp};
40pub use sched::{greedy_concurrency, Action, Capability, Scheduler, Source, Stats, STEAL_QUANTUM};