Downgrade visibility within librqbit

This commit is contained in:
Igor Katson 2023-11-23 16:57:27 +00:00
parent 84766f92fb
commit f45a15c89a
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
9 changed files with 44 additions and 72 deletions

View file

@ -4,7 +4,7 @@ use tracing::{debug, info};
use crate::type_aliases::BF;
pub struct ChunkTracker {
pub(crate) struct ChunkTracker {
// This forms the basis of a "queue" to pull from.
// It's set to 1 if we need a piece, but the moment we start requesting a peer,
// it's set to 0.
@ -51,7 +51,7 @@ fn compute_chunk_status(lengths: &Lengths, needed_pieces: &BF) -> BF {
chunk_bf
}
pub enum ChunkMarkingResult {
pub(crate) enum ChunkMarkingResult {
PreviouslyCompleted,
NotCompleted,
Completed,
@ -75,9 +75,7 @@ impl ChunkTracker {
priority_piece_ids,
}
}
pub fn get_needed_pieces(&self) -> &BF {
&self.needed_pieces
}
pub fn get_have_pieces(&self) -> &BF {
&self.have
}
@ -132,13 +130,6 @@ impl ChunkTracker {
self.have.set(idx.get() as usize, true);
}
pub fn is_chunk_downloaded(&self, chunk: &ChunkInfo) -> bool {
*self
.chunk_status
.get(chunk.absolute_index as usize)
.unwrap()
}
pub fn is_chunk_ready_to_upload(&self, chunk: &ChunkInfo) -> bool {
self.have
.get(chunk.piece_index.get() as usize)