File indexing completed on 2025-01-05 04:37:17

0001 /*
0002     SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #ifndef BTCHUNKDOWNLOADINTERFACE_H
0007 #define BTCHUNKDOWNLOADINTERFACE_H
0008 
0009 #include <qstring.h>
0010 #include <util/constants.h>
0011 
0012 namespace bt
0013 {
0014 /**
0015  * @author Joris Guisson
0016  * @brief Interface for a ChunkDownload
0017  *
0018  * This class provides the interface for a ChunkDownload object.
0019  */
0020 class ChunkDownloadInterface
0021 {
0022 public:
0023     ChunkDownloadInterface();
0024     virtual ~ChunkDownloadInterface();
0025 
0026     struct Stats {
0027         /// The PeerID of the current downloader
0028         QString current_peer_id;
0029         /// The current download speed
0030         bt::Uint32 download_speed;
0031         /// The index of the chunk
0032         bt::Uint32 chunk_index;
0033         /// The number of pieces of the chunk which have been downloaded
0034         bt::Uint32 pieces_downloaded;
0035         /// The total number of pieces of the chunk
0036         bt::Uint32 total_pieces;
0037         /// The number of assigned downloaders
0038         bt::Uint32 num_downloaders;
0039     };
0040 
0041     virtual void getStats(Stats &s) = 0;
0042 };
0043 
0044 }
0045 
0046 #endif