• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

bt::ChunkDownload

bt::ChunkDownload Class Reference

#include <chunkdownload.h>

Inheritance diagram for bt::ChunkDownload:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Joris Guisson

Handles the download off one Chunk off a Peer

This class handles the download of one Chunk.

Definition at line 60 of file chunkdownload.h.


Public Member Functions

bool assign (PieceDownloader *pd)
Uint32 bytesDownloaded () const
void cancelAll ()
 ChunkDownload (Chunk *chunk)
bool containsPeer (PieceDownloader *pd)
Chunk * getChunk ()
Uint32 getChunkIndex () const
Uint32 getDownloadSpeed () const
SHA1Hash getHash () const
Uint32 getNumDownloaders () const
PieceDownloader * getOnlyDownloader ()
QString getPieceDownloaderName () const
Uint32 getPiecesDownloaded () const
void getStats (Stats &s)
Uint32 getTotalPieces () const
bool isChoked () const
bool isIdle () const
void killed (PieceDownloader *pd)
bool load (File &file, ChunkDownloadHeader &hdr)
bool needsToBeUpdated () const
bool piece (const Piece &p, bool &ok)
void releaseAllPDs ()
void save (File &file)
void update ()
bool usingContinuousHashing () const
virtual ~ChunkDownload ()

Friends

File & operator<< (File &out, const ChunkDownload &cd)
File & operator>> (File &in, ChunkDownload &cd)

Constructor & Destructor Documentation

bt::ChunkDownload::ChunkDownload ( Chunk *  chunk  ) 

Constructor, set the chunk and the PeerManager.

Parameters:
chunk The Chunk

Definition at line 65 of file chunkdownload.cpp.

bt::ChunkDownload::~ChunkDownload (  )  [virtual]

Definition at line 96 of file chunkdownload.cpp.


Member Function Documentation

bool bt::ChunkDownload::assign ( PieceDownloader *  pd  ) 

Assign the downloader to download from.

Parameters:
pd The downloader
Returns:
true if the peer was asigned, false if not

Definition at line 161 of file chunkdownload.cpp.

Uint32 bt::ChunkDownload::bytesDownloaded (  )  const

Get the number of bytes downloaded.

Definition at line 388 of file chunkdownload.cpp.

void bt::ChunkDownload::cancelAll (  ) 

Cancel all requests.

Definition at line 401 of file chunkdownload.cpp.

bool bt::ChunkDownload::containsPeer ( PieceDownloader *  pd  )  [inline]

See if a PieceDownloader is assigned to this chunk.

Definition at line 145 of file chunkdownload.h.

Chunk* bt::ChunkDownload::getChunk (  )  [inline]

Get the chunk.

Definition at line 73 of file chunkdownload.h.

Uint32 bt::ChunkDownload::getChunkIndex (  )  const

Get the index of the chunk.

Definition at line 306 of file chunkdownload.cpp.

Uint32 bt::ChunkDownload::getDownloadSpeed (  )  const

Get the download speed.

Definition at line 327 of file chunkdownload.cpp.

SHA1Hash bt::ChunkDownload::getHash (  )  const [inline]

Get the SHA1 hash of the downloaded chunk.

Definition at line 160 of file chunkdownload.h.

Uint32 bt::ChunkDownload::getNumDownloaders (  )  const [inline]

Get the number of downloaders.

Definition at line 166 of file chunkdownload.h.

PieceDownloader * bt::ChunkDownload::getOnlyDownloader (  ) 

When a Chunk is downloaded, this function checks if all pieces are delivered by the same peer and if so returns it.

Returns:
The PieceDownloader or 0 if there is no only peer

Definition at line 411 of file chunkdownload.cpp.

QString bt::ChunkDownload::getPieceDownloaderName (  )  const

Get the PeerID of the current peer.

Definition at line 311 of file chunkdownload.cpp.

Uint32 bt::ChunkDownload::getPiecesDownloaded (  )  const [inline]

Get the number of pieces downloaded.

Definition at line 79 of file chunkdownload.h.

void bt::ChunkDownload::getStats ( Stats &  s  )  [virtual]

Get download stats.

Implements bt::ChunkDownloadInterface.

Definition at line 423 of file chunkdownload.cpp.

Uint32 bt::ChunkDownload::getTotalPieces (  )  const [inline]

Get the total number of pieces.

Definition at line 76 of file chunkdownload.h.

bool bt::ChunkDownload::isChoked (  )  const

See if the download is choked (i.e. all downloaders are choked).

Definition at line 433 of file chunkdownload.cpp.

bool bt::ChunkDownload::isIdle (  )  const [inline]

See if a chunkdownload is idle (i.e. has no downloaders).

Definition at line 97 of file chunkdownload.h.

void bt::ChunkDownload::killed ( PieceDownloader *  pd  ) 

A PieceDownloader has been killed.

We need to remove it.

Parameters:
pd The PieceDownloader

Definition at line 295 of file chunkdownload.cpp.

bool bt::ChunkDownload::load ( File &  file,
ChunkDownloadHeader &  hdr 
)

Load from a File.

Parameters:
file The File

Definition at line 357 of file chunkdownload.cpp.

bool bt::ChunkDownload::needsToBeUpdated (  )  const [inline]

See if this CD hasn't been active in the last update.

Definition at line 157 of file chunkdownload.h.

bool bt::ChunkDownload::piece ( const Piece &  p,
bool &  ok 
)

A Piece has arived.

Parameters:
p The Piece
ok Whether or not the piece was needed
Returns:
true If Chunk is complete

Definition at line 101 of file chunkdownload.cpp.

void bt::ChunkDownload::releaseAllPDs (  ) 

Release all PD's and clear the requested chunks.

Definition at line 149 of file chunkdownload.cpp.

void bt::ChunkDownload::save ( File &  file  ) 

Save to a File.

Parameters:
file The File

Definition at line 338 of file chunkdownload.cpp.

void bt::ChunkDownload::update (  ) 

Send requests to peers.

Definition at line 249 of file chunkdownload.cpp.

bool bt::ChunkDownload::usingContinuousHashing (  )  const

Are we using the continuous hashing feature for this chunk.

Definition at line 462 of file chunkdownload.cpp.


Friends And Related Function Documentation

File& operator<< ( File &  out,
const ChunkDownload &  cd 
) [friend]

File& operator>> ( File &  in,
ChunkDownload &  cd 
) [friend]


The documentation for this class was generated from the following files:
  • chunkdownload.h
  • chunkdownload.cpp

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal