libktorrent  2.2.0
Public Member Functions | Protected Attributes | List of all members
bt::ChunkSelectorInterface Class Referenceabstract

#include <chunkselectorinterface.h>

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

Public Member Functions

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

Protected Attributes

ChunkManagercman
 
Downloaderdowner
 
PeerManagerpman
 

Detailed Description

Author
Joris Guisson

Interface class for selecting chunks to download.

Definition at line 59 of file chunkselectorinterface.h.

Member Function Documentation

◆ dataChecked()

virtual void bt::ChunkSelectorInterface::dataChecked ( const BitSet ok_chunks,
Uint32  from,
Uint32  to 
)
pure virtual

Data has been checked, and these chunks are OK.

Parameters
ok_chunksThe ok_chunks
fromFirst chunk of check
toLast chunk of check

Implemented in bt::StreamingChunkSelector, and bt::ChunkSelector.

◆ init()

virtual void bt::ChunkSelectorInterface::init ( ChunkManager cman,
Downloader downer,
PeerManager pman 
)
virtual

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

Parameters
cmanThe ChunkManager
downerThe Downloader
pmanThe PeerManager

Reimplemented in bt::StreamingChunkSelector, and bt::ChunkSelector.

◆ reincluded()

virtual void bt::ChunkSelectorInterface::reincluded ( Uint32  from,
Uint32  to 
)
pure virtual

A range of chunks has been reincluded. This is called when a user reselects a file for download.

Parameters
fromThe first chunk
toThe last chunk

Implemented in bt::ChunkSelector, and bt::StreamingChunkSelector.

◆ reinsert()

virtual void bt::ChunkSelectorInterface::reinsert ( Uint32  chunk)
pure virtual

Reinsert a chunk. This is called when a chunk is corrupted or downloading it failed (hash doesn't match) The selector should make sure that this is added again

Parameters
chunkThe chunk

Implemented in bt::ChunkSelector, and bt::StreamingChunkSelector.

◆ select()

virtual bool bt::ChunkSelectorInterface::select ( PieceDownloader pd,
Uint32 &  chunk 
)
pure virtual

Select which chunk to download for a PieceDownloader.

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

Implemented in bt::ChunkSelector, and bt::StreamingChunkSelector.

◆ selectRange()

virtual bool bt::ChunkSelectorInterface::selectRange ( Uint32 &  from,
Uint32 &  to,
Uint32  max_len 
)
virtual

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 in bt::ChunkSelector, and bt::StreamingChunkSelector.


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