2023-11-23 16:27:55 +00:00
|
|
|
pub mod utils;
|
|
|
|
|
|
2023-11-23 15:41:40 +00:00
|
|
|
pub mod live;
|
2023-11-19 18:15:18 +00:00
|
|
|
|
2023-11-23 17:14:08 +00:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
|
|
use buffers::ByteString;
|
|
|
|
|
use librqbit_core::id20::Id20;
|
|
|
|
|
use librqbit_core::torrent_metainfo::TorrentMetaV1Info;
|
2023-11-23 15:41:40 +00:00
|
|
|
pub use live::*;
|
2023-11-23 17:14:08 +00:00
|
|
|
use parking_lot::RwLock;
|
|
|
|
|
use tokio::sync::mpsc::Sender;
|
|
|
|
|
use url::Url;
|
|
|
|
|
|
|
|
|
|
pub(crate) enum ManagedTorrentState {
|
|
|
|
|
Live {
|
|
|
|
|
state: TorrentStateLive,
|
|
|
|
|
only_files_tx: Sender<Vec<usize>>,
|
|
|
|
|
trackers_tx: Sender<Url>,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) struct ManagedTorrentLocked {
|
|
|
|
|
pub trackers: Vec<Url>,
|
|
|
|
|
pub only_files: Vec<usize>,
|
|
|
|
|
pub state: ManagedTorrentState,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct ManagedTorrentInfo {
|
|
|
|
|
pub info: TorrentMetaV1Info<ByteString>,
|
|
|
|
|
pub info_hash: Id20,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) struct ManagedTorrent {
|
|
|
|
|
pub info: Arc<ManagedTorrentInfo>,
|
|
|
|
|
pub(crate) locked: RwLock<ManagedTorrentLocked>,
|
|
|
|
|
}
|