libktorrent  2.2.0
Public Member Functions | Protected Member Functions | List of all members
bt::ChunkSelector Class Reference

#include <chunkselector.h>

Inheritance diagram for bt::ChunkSelector:
Inheritance graph
[legend]

Public Member Functions

void dataChecked (const bt::BitSet &ok_chunks, bt::Uint32 from, bt::Uint32 to) override
 
void init (ChunkManager *cman, Downloader *downer, PeerManager *pman) override
 
void reincluded (Uint32 from, Uint32 to) override
 
void reinsert (Uint32 chunk) override
 
bool select (PieceDownloader *pd, Uint32 &chunk) override
 
bool selectRange (Uint32 &from, Uint32 &to, Uint32 max_len) override
 

Protected Member Functions

Uint32 leastPeers (const std::list< Uint32 > &lp, Uint32 alternative, Uint32 max_peers_per_chunk)
 

Additional Inherited Members

- Protected Attributes inherited from bt::ChunkSelectorInterface
ChunkManagercman
 
Downloaderdowner
 
PeerManagerpman
 

Detailed Description

Author
Joris Guisson

Selects which Chunks to download.

Definition at line 60 of file chunkselector.h.

Member Function Documentation

◆ dataChecked()

void bt::ChunkSelector::dataChecked ( const bt::BitSet ok_chunks,
bt::Uint32  from,
bt::Uint32  to 
)
overridevirtual

Data has been checked, and these chunks are OK.

Parameters
ok_chunksThe ok_chunks

Implements bt::ChunkSelectorInterface.

Reimplemented in bt::StreamingChunkSelector.

◆ init()

void bt::ChunkSelector::init ( ChunkManager cman,
Downloader downer,
PeerManager pman 
)
overridevirtual

Initialize the chunk selector, will be called automatically when the ChunkSelector is set.

Parameters
cmanThe ChunkManager
downerThe Downloader
pmanThe PeerManager

Reimplemented from bt::ChunkSelectorInterface.

Reimplemented in bt::StreamingChunkSelector.

◆ reincluded()

void bt::ChunkSelector::reincluded ( Uint32  from,
Uint32  to 
)
overridevirtual

A range of chunks has been reincluded.

Parameters
fromThe first chunk
toThe last chunk

Implements bt::ChunkSelectorInterface.

Reimplemented in bt::StreamingChunkSelector.

◆ reinsert()

void bt::ChunkSelector::reinsert ( Uint32  chunk)
overridevirtual

Reinsert a chunk.

Parameters
chunkThe chunk

Implements bt::ChunkSelectorInterface.

Reimplemented in bt::StreamingChunkSelector.

◆ select()

bool bt::ChunkSelector::select ( PieceDownloader pd,
Uint32 &  chunk 
)
overridevirtual

Select which chunk to download for a PieceDownloader.

Parameters
pdThe PieceDownloader
chunkIndex of chunk gets stored here
Returns
true upon succes, false otherwise

Implements bt::ChunkSelectorInterface.

Reimplemented in bt::StreamingChunkSelector.

◆ selectRange()

bool bt::ChunkSelector::selectRange ( Uint32 &  from,
Uint32 &  to,
Uint32  max_len 
)
overridevirtual

Select a range of chunks to download from a webseeder.

Parameters
fromFirst chunk of the range
toLast chunk of the range
max_lenMaximum length of range
Returns
true if everything is OK

Reimplemented from bt::ChunkSelectorInterface.

Reimplemented in bt::StreamingChunkSelector.


The documentation for this class was generated from the following file: