mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Recent updates in storage (#667)
* Fix error handling in Torrent.cpp, improve choosing peers for upload * Various improvements in storage daemon "get-pieces-info" Store "added at" Improve calculating up/down speed Improve TL protocol for future compatibility Remove empty directories on "--remove-files" Better windows support Debug logs in PeerActor More restrictions on TorrentInfo Bugfixes * Global speed limits for download and upload +bugfix * Reset download/upload speed on changing settings or completion * Exclude some system files in TorrentCreator
This commit is contained in:
parent
e3af63e6c0
commit
bb21f732fd
21 changed files with 974 additions and 213 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "overlay/overlays.h"
|
||||
#include "storage/PeerManager.h"
|
||||
#include "storage/db.h"
|
||||
#include "SpeedLimiter.h"
|
||||
|
||||
namespace ton {
|
||||
|
||||
|
@ -63,6 +64,10 @@ class StorageManager : public td::actor::Actor {
|
|||
void wait_for_completion(td::Bits256 hash, td::Promise<td::Unit> promise);
|
||||
void get_peers_info(td::Bits256 hash, td::Promise<tl_object_ptr<ton_api::storage_daemon_peerList>> promise);
|
||||
|
||||
void get_speed_limits(td::Promise<std::pair<double, double>> promise); // Download, upload
|
||||
void set_download_speed_limit(double max_speed);
|
||||
void set_upload_speed_limit(double max_speed);
|
||||
|
||||
private:
|
||||
adnl::AdnlNodeIdShort local_id_;
|
||||
std::string db_root_;
|
||||
|
@ -89,6 +94,13 @@ class StorageManager : public td::actor::Actor {
|
|||
|
||||
std::map<td::Bits256, TorrentEntry> torrents_;
|
||||
|
||||
double download_speed_limit_ = -1.0;
|
||||
double upload_speed_limit_ = -1.0;
|
||||
td::actor::ActorOwn<SpeedLimiter> download_speed_limiter_ =
|
||||
td::actor::create_actor<SpeedLimiter>("DownloadRateLimitrer", -1.0);
|
||||
td::actor::ActorOwn<SpeedLimiter> upload_speed_limiter_ =
|
||||
td::actor::create_actor<SpeedLimiter>("DownloadRateLimitrer", -1.0);
|
||||
|
||||
td::Status add_torrent_impl(Torrent torrent, bool start_download, bool allow_upload);
|
||||
|
||||
td::Result<TorrentEntry*> get_torrent(td::Bits256 hash) {
|
||||
|
@ -102,9 +114,11 @@ class StorageManager : public td::actor::Actor {
|
|||
td::unique_ptr<NodeActor::Callback> create_callback(td::Bits256 hash,
|
||||
std::shared_ptr<TorrentEntry::ClosingState> closing_state);
|
||||
|
||||
void loaded_config_from_db(tl_object_ptr<ton_api::storage_db_config> config);
|
||||
void load_torrents_from_db(std::vector<td::Bits256> torrents);
|
||||
void loaded_torrent_from_db(td::Bits256 hash, td::Result<td::actor::ActorOwn<NodeActor>> R);
|
||||
void after_load_torrents_from_db();
|
||||
void db_store_config();
|
||||
void db_store_torrent_list();
|
||||
|
||||
void on_torrent_closed(Torrent torrent, std::shared_ptr<TorrentEntry::ClosingState> closing_state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue