Furrent
|
Completely describes a torrent in furrent. More...
#include <torrent.hpp>
Public Member Functions | |
Torrent () | |
Construct empty temporary torrent. More... | |
Torrent (TorrentID tid, const TorrentFile &descriptor) | |
void | announce () |
Announces the client to the tracker and sets the list of peers. More... | |
void | atomic_add_peer_score (int64_t peer_index) |
TorrentID | tid () const |
Returns unique id. More... | |
const TorrentFile & | descriptor () const |
Returns the .torrent descriptor. More... | |
std::vector< peer::Peer > | peers () const |
Returns the loaded peers. More... | |
std::discrete_distribution< int64_t > | distribution () const |
Returns a peer distribution. More... | |
std::vector< Piece > | pieces () const |
Generate all pieces of this torrent. More... | |
Public Attributes | |
std::atomic< TorrentState > | state |
std::atomic_int64_t | pieces_processed |
Completely describes a torrent in furrent.
|
explicit |
Construct empty temporary torrent.
fur::Torrent::Torrent | ( | TorrentID | tid, |
const TorrentFile & | descriptor | ||
) |
Construct a new Torrent
tid | unique id of the torrent |
descriptor | parsed .torrent file descriptor |
void fur::Torrent::announce | ( | ) |
Announces the client to the tracker and sets the list of peers.
void fur::Torrent::atomic_add_peer_score | ( | int64_t | peer_index | ) |
Atomically increment score of a peer
peer_index | index of the peer to increment |
const TorrentFile & fur::Torrent::descriptor | ( | ) | const |
Returns the .torrent descriptor.
std::discrete_distribution< int64_t > fur::Torrent::distribution | ( | ) | const |
Returns a peer distribution.
std::vector< peer::Peer > fur::Torrent::peers | ( | ) | const |
Returns the loaded peers.
std::vector< Piece > fur::Torrent::pieces | ( | ) | const |
Generate all pieces of this torrent.
TorrentID fur::Torrent::tid | ( | ) | const |
Returns unique id.
std::atomic_int64_t fur::Torrent::pieces_processed |
Number of pieces downloaded and written to file. this value can be changed concurrently
std::atomic<TorrentState> fur::Torrent::state |
Current state of the torrent, this value can be changed concurrently