Furrent
Public Member Functions | Public Attributes | List of all members
fur::Torrent Class Reference

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 TorrentFiledescriptor () const
 Returns the .torrent descriptor. More...
 
std::vector< peer::Peerpeers () const
 Returns the loaded peers. More...
 
std::discrete_distribution< int64_t > distribution () const
 Returns a peer distribution. More...
 
std::vector< Piecepieces () const
 Generate all pieces of this torrent. More...
 

Public Attributes

std::atomic< TorrentStatestate
 
std::atomic_int64_t pieces_processed
 

Detailed Description

Completely describes a torrent in furrent.

Constructor & Destructor Documentation

◆ Torrent() [1/2]

fur::Torrent::Torrent ( )
explicit

Construct empty temporary torrent.

◆ Torrent() [2/2]

fur::Torrent::Torrent ( TorrentID  tid,
const TorrentFile descriptor 
)

Construct a new Torrent

Parameters
tidunique id of the torrent
descriptorparsed .torrent file descriptor

Member Function Documentation

◆ announce()

void fur::Torrent::announce ( )

Announces the client to the tracker and sets the list of peers.

◆ atomic_add_peer_score()

void fur::Torrent::atomic_add_peer_score ( int64_t  peer_index)

Atomically increment score of a peer

Parameters
peer_indexindex of the peer to increment

◆ descriptor()

const TorrentFile & fur::Torrent::descriptor ( ) const

Returns the .torrent descriptor.

◆ distribution()

std::discrete_distribution< int64_t > fur::Torrent::distribution ( ) const

Returns a peer distribution.

◆ peers()

std::vector< peer::Peer > fur::Torrent::peers ( ) const

Returns the loaded peers.

◆ pieces()

std::vector< Piece > fur::Torrent::pieces ( ) const

Generate all pieces of this torrent.

◆ tid()

TorrentID fur::Torrent::tid ( ) const

Returns unique id.

Member Data Documentation

◆ pieces_processed

std::atomic_int64_t fur::Torrent::pieces_processed

Number of pieces downloaded and written to file. this value can be changed concurrently

◆ state

std::atomic<TorrentState> fur::Torrent::state

Current state of the torrent, this value can be changed concurrently


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