mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Extra shard overlay stats
This commit is contained in:
parent
8c4bc5b3f1
commit
da137fecf5
7 changed files with 62 additions and 4 deletions
|
@ -39,6 +39,9 @@
|
|||
#include "td/utils/Random.h"
|
||||
|
||||
#include "common/delay.h"
|
||||
#include "td/utils/JsonBuilder.h"
|
||||
#include "tl/tl_json.h"
|
||||
#include "auto/tl/ton_api_json.h"
|
||||
|
||||
namespace ton {
|
||||
|
||||
|
@ -99,6 +102,9 @@ void FullNodeShardImpl::create_overlay() {
|
|||
td::Promise<td::Unit> promise) override {
|
||||
td::actor::send_closure(node_, &FullNodeShardImpl::check_broadcast, src, std::move(data), std::move(promise));
|
||||
}
|
||||
void get_stats_extra(td::Promise<std::string> promise) override {
|
||||
td::actor::send_closure(node_, &FullNodeShardImpl::get_stats_extra, std::move(promise));
|
||||
}
|
||||
Callback(td::actor::ActorId<FullNodeShardImpl> node) : node_(node) {
|
||||
}
|
||||
|
||||
|
@ -1290,6 +1296,34 @@ void FullNodeShardImpl::ping_neighbours() {
|
|||
}
|
||||
}
|
||||
|
||||
void FullNodeShardImpl::get_stats_extra(td::Promise<std::string> promise) {
|
||||
auto res = create_tl_object<ton_api::engine_validator_shardOverlayStats>();
|
||||
res->shard_ = shard_.to_str();
|
||||
switch (mode_) {
|
||||
case active:
|
||||
res->mode_ = "active";
|
||||
break;
|
||||
case active_temp:
|
||||
res->mode_ = "active_temp";
|
||||
break;
|
||||
case inactive:
|
||||
res->mode_ = "inactive";
|
||||
break;
|
||||
}
|
||||
for (const auto &p : neighbours_) {
|
||||
const auto &n = p.second;
|
||||
auto f = create_tl_object<ton_api::engine_validator_shardOverlayStats_neighbour>();
|
||||
f->id_ = n.adnl_id.bits256_value().to_hex();
|
||||
f->proto_verison_ = n.proto_version;
|
||||
f->capabilities_ = n.capabilities;
|
||||
f->roundtrip_ = n.roundtrip;
|
||||
f->unreliability_ = n.unreliability;
|
||||
f->has_state_ = (n.has_state_known ? (n.has_state ? "true" : "false") : "undefined");
|
||||
res->neighbours_.push_back(std::move(f));
|
||||
}
|
||||
promise.set_result(td::json_encode<std::string>(td::ToJson(*res), true));
|
||||
}
|
||||
|
||||
FullNodeShardImpl::FullNodeShardImpl(ShardIdFull shard, PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id,
|
||||
FileHash zero_state_file_hash, FullNodeConfig config,
|
||||
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
|
|
|
@ -164,6 +164,7 @@ class FullNodeShardImpl : public FullNodeShard {
|
|||
void process_broadcast(PublicKeyHash src, ton_api::tonNode_newShardBlockBroadcast &query);
|
||||
void receive_broadcast(PublicKeyHash src, td::BufferSlice query);
|
||||
void check_broadcast(PublicKeyHash src, td::BufferSlice query, td::Promise<td::Unit> promise);
|
||||
void get_stats_extra(td::Promise<std::string> promise);
|
||||
void remove_neighbour(adnl::AdnlNodeIdShort id);
|
||||
|
||||
void send_ihr_message(td::BufferSlice data) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue