mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
liteserver: bugfix
liteserver/liteclient: fixed bug in proof validator: added stats smartcontracts: updates
This commit is contained in:
parent
ecb3e06a06
commit
2845f9a2cc
30 changed files with 280 additions and 124 deletions
|
@ -353,6 +353,45 @@ FileDb::DbEntry::DbEntry(tl_object_ptr<ton_api::db_filedb_value> entry)
|
|||
, file_hash(entry->file_hash_) {
|
||||
}
|
||||
|
||||
void FileDb::prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise) {
|
||||
std::vector<std::pair<std::string, std::string>> rocksdb_stats;
|
||||
auto stats = kv_->stats();
|
||||
if (stats.size() == 0) {
|
||||
promise.set_value(std::move(rocksdb_stats));
|
||||
return;
|
||||
}
|
||||
size_t pos = 0;
|
||||
while (pos < stats.size()) {
|
||||
while (pos < stats.size() &&
|
||||
(stats[pos] == ' ' || stats[pos] == '\n' || stats[pos] == '\r' || stats[pos] == '\t')) {
|
||||
pos++;
|
||||
}
|
||||
auto p = pos;
|
||||
if (pos == stats.size()) {
|
||||
break;
|
||||
}
|
||||
while (stats[pos] != '\n' && stats[pos] != '\r' && stats[pos] != ' ' && stats[pos] != '\t' && pos < stats.size()) {
|
||||
pos++;
|
||||
}
|
||||
auto name = stats.substr(p, pos - p);
|
||||
if (stats[pos] == '\n' || pos == stats.size()) {
|
||||
rocksdb_stats.emplace_back(name, "");
|
||||
continue;
|
||||
}
|
||||
while (pos < stats.size() &&
|
||||
(stats[pos] == ' ' || stats[pos] == '\n' || stats[pos] == '\r' || stats[pos] == '\t')) {
|
||||
pos++;
|
||||
}
|
||||
p = pos;
|
||||
while (stats[pos] != '\n' && stats[pos] != '\r' && pos < stats.size()) {
|
||||
pos++;
|
||||
}
|
||||
auto value = stats.substr(p, pos - p);
|
||||
rocksdb_stats.emplace_back(name, value);
|
||||
}
|
||||
promise.set_value(std::move(rocksdb_stats));
|
||||
}
|
||||
|
||||
} // namespace validator
|
||||
|
||||
} // namespace ton
|
||||
|
|
|
@ -147,6 +147,8 @@ class FileDb : public td::actor::Actor {
|
|||
void load_file_slice(RefId ref_id, td::int64 offset, td::int64 max_size, td::Promise<td::BufferSlice> promise);
|
||||
void check_file(RefId ref_id, td::Promise<bool> promise);
|
||||
|
||||
void prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise);
|
||||
|
||||
void start_up() override;
|
||||
void alarm() override;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "ton/ton-tl.hpp"
|
||||
#include "td/utils/overloaded.h"
|
||||
#include "common/checksum.h"
|
||||
#include "validator/stats-merger.h"
|
||||
|
||||
namespace ton {
|
||||
|
||||
|
@ -473,6 +474,13 @@ void RootDb::allow_gc(FileDb::RefId ref_id, bool is_archive, td::Promise<bool> p
|
|||
}));
|
||||
}
|
||||
|
||||
void RootDb::prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise) {
|
||||
auto merger = StatsMerger::create(std::move(promise));
|
||||
|
||||
td::actor::send_closure(file_db_, &FileDb::prepare_stats, merger.make_promise("filedb."));
|
||||
td::actor::send_closure(archive_db_, &FileDb::prepare_stats, merger.make_promise("archivedb."));
|
||||
}
|
||||
|
||||
} // namespace validator
|
||||
|
||||
} // namespace ton
|
||||
|
|
|
@ -110,6 +110,8 @@ class RootDb : public Db {
|
|||
void allow_block_gc(BlockIdExt block_id, td::Promise<bool> promise);
|
||||
void allow_gc(FileDb::RefId ref_id, bool is_archive, td::Promise<bool> promise);
|
||||
|
||||
void prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise) override;
|
||||
|
||||
private:
|
||||
td::actor::ActorId<ValidatorManager> validator_manager_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue