use super::{ BTreeMap, BtRuntimeState, BtShareRuntimeState, DownloadId, DownloadStatus, OptionPatch, PieceId, PieceMap, RequestContext, ResumeState, RetryAttempt, SegmentAssignment, }; /// Canonical in-memory request group model used by the runtime and RPC layers. #[derive(Clone, Debug, Eq, PartialEq)] pub struct RequestGroup { /// Stable identifier exposed on the RPC surface. pub(super) gid: DownloadId, /// Source URIs, headers, and request metadata for the transfer. pub(super) context: RequestContext, /// Current lifecycle state of the transfer. pub(super) status: DownloadStatus, /// Piece map tracking completed and pending ranges. pub(super) pieces: PieceMap, /// Per-download option overrides layered over runtime defaults. pub(super) options: OptionPatch, /// Total expected payload length in bytes. pub(super) total_length: u64, /// Piece size used for segmented scheduling and control-file state. pub(super) piece_length: u64, /// Total uploaded payload length in bytes. pub(super) upload_length: u64, /// Last observed upload speed in bytes per second. pub(super) upload_speed: u64, /// Last observed download speed in bytes per second. pub(super) download_speed: u64, /// Number of currently active source connections. pub(super) num_connections: u32, /// Verified completed payload length in bytes. pub(super) completed_length: u64, /// Monotonic sequence used to order stopped downloads for RPC listing. pub(super) stopped_sequence: Option, /// Number of retry cycles already consumed by this request group. pub(super) retry_count: u32, /// Recorded retry attempts for diagnostics and RPC status reporting. pub(super) retry_attempts: Vec, /// Resume metadata recovered from storage or prior runtime state. pub(super) resume_state: Option, /// DHT token cached for the next announce-peer exchange. pub(super) dht_token: Option>, /// Planned and active segment assignments for split transfers. pub(super) segment_assignments: Vec, /// Availability counters for each piece observed from swarm peers. pub(super) piece_availability: BTreeMap, /// BitTorrent-specific runtime state when the group is BT-backed. pub(super) bt: Option, /// Seeding and share-ratio counters when the BT runtime is active. pub(super) bt_share_state: Option, }