chore: initial sanitized public snapshot

This commit is contained in:
Aria2 Rust Pro Contributors
2026-07-18 14:04:26 +08:00
commit 7b3816441c
320 changed files with 76813 additions and 0 deletions
@@ -0,0 +1,51 @@
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<u64>,
/// 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<RetryAttempt>,
/// Resume metadata recovered from storage or prior runtime state.
pub(super) resume_state: Option<ResumeState>,
/// DHT token cached for the next announce-peer exchange.
pub(super) dht_token: Option<Vec<u8>>,
/// Planned and active segment assignments for split transfers.
pub(super) segment_assignments: Vec<SegmentAssignment>,
/// Availability counters for each piece observed from swarm peers.
pub(super) piece_availability: BTreeMap<PieceId, u32>,
/// BitTorrent-specific runtime state when the group is BT-backed.
pub(super) bt: Option<BtRuntimeState>,
/// Seeding and share-ratio counters when the BT runtime is active.
pub(super) bt_share_state: Option<BtShareRuntimeState>,
}