mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Validator patch: state download, adnl stats (#1257)
* Persistent state download improvements 1) Don't start over on restart 2) Download shards one at a time to reduce RAM usage 3) More logs * Remove old peers from adnl stats
This commit is contained in:
parent
1da94e62ad
commit
b69214b6af
19 changed files with 135 additions and 76 deletions
|
@ -1306,13 +1306,21 @@ td::Status GetCollatorOptionsJsonQuery::receive(td::BufferSlice data) {
|
|||
|
||||
td::Status GetAdnlStatsJsonQuery::run() {
|
||||
TRY_RESULT_ASSIGN(file_name_, tokenizer_.get_token<std::string>());
|
||||
if (!tokenizer_.endl()) {
|
||||
TRY_RESULT(s, tokenizer_.get_token<std::string>());
|
||||
if (s == "all") {
|
||||
all_ = true;
|
||||
} else {
|
||||
return td::Status::Error(PSTRING() << "unexpected token " << s);
|
||||
}
|
||||
}
|
||||
TRY_STATUS(tokenizer_.check_endl());
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
||||
td::Status GetAdnlStatsJsonQuery::send() {
|
||||
auto b =
|
||||
ton::create_serialize_tl_object<ton::ton_api::engine_validator_getAdnlStats>();
|
||||
ton::create_serialize_tl_object<ton::ton_api::engine_validator_getAdnlStats>(all_);
|
||||
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
@ -1327,13 +1335,21 @@ td::Status GetAdnlStatsJsonQuery::receive(td::BufferSlice data) {
|
|||
}
|
||||
|
||||
td::Status GetAdnlStatsQuery::run() {
|
||||
if (!tokenizer_.endl()) {
|
||||
TRY_RESULT(s, tokenizer_.get_token<std::string>());
|
||||
if (s == "all") {
|
||||
all_ = true;
|
||||
} else {
|
||||
return td::Status::Error(PSTRING() << "unexpected token " << s);
|
||||
}
|
||||
}
|
||||
TRY_STATUS(tokenizer_.check_endl());
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
||||
td::Status GetAdnlStatsQuery::send() {
|
||||
auto b =
|
||||
ton::create_serialize_tl_object<ton::ton_api::engine_validator_getAdnlStats>();
|
||||
ton::create_serialize_tl_object<ton::ton_api::engine_validator_getAdnlStats>(all_);
|
||||
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
|
|
@ -1327,7 +1327,8 @@ class GetAdnlStatsJsonQuery : public Query {
|
|||
return "getadnlstatsjson";
|
||||
}
|
||||
static std::string get_help() {
|
||||
return "getadnlstatsjson <filename>\tsave adnl stats to <filename>";
|
||||
return "getadnlstatsjson <filename> [all]\tsave adnl stats to <filename>. all - returns all peers (default - only "
|
||||
"peers with traffic in the last 10 minutes)";
|
||||
}
|
||||
std::string name() const override {
|
||||
return get_name();
|
||||
|
@ -1335,6 +1336,7 @@ class GetAdnlStatsJsonQuery : public Query {
|
|||
|
||||
private:
|
||||
std::string file_name_;
|
||||
bool all_ = false;
|
||||
};
|
||||
|
||||
class GetAdnlStatsQuery : public Query {
|
||||
|
@ -1349,7 +1351,8 @@ class GetAdnlStatsQuery : public Query {
|
|||
return "getadnlstats";
|
||||
}
|
||||
static std::string get_help() {
|
||||
return "getadnlstats\tdisplay adnl stats";
|
||||
return "getadnlstats [all]\tdisplay adnl stats. all - returns all peers (default - only peers with traffic in the "
|
||||
"last 10 minutes)";
|
||||
}
|
||||
std::string name() const override {
|
||||
return get_name();
|
||||
|
@ -1357,4 +1360,5 @@ class GetAdnlStatsQuery : public Query {
|
|||
|
||||
private:
|
||||
std::string file_name_;
|
||||
bool all_ = false;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue