summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp')
-rw-r--r--protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp b/protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp
index f3984062fc..fd2498f256 100644
--- a/protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp
+++ b/protocols/Telegram/tdlib/td/tddb/td/db/binlog/binlog_dump.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -44,20 +44,20 @@ struct Trie {
};
td::vector<FullNode> nodes_;
- void do_add(int id, td::Slice value) {
- nodes_[id].sum++;
+ void do_add(int event_id, td::Slice value) {
+ nodes_[event_id].sum++;
if (value.empty()) {
return;
}
auto c = static_cast<td::uint8>(value[0]);
- auto next_id = nodes_[id].next[c];
- if (next_id == 0) {
- next_id = static_cast<int>(nodes_.size());
+ auto next_event_id = nodes_[event_id].next[c];
+ if (next_event_id == 0) {
+ next_event_id = static_cast<int>(nodes_.size());
nodes_.emplace_back();
- nodes_[id].next[c] = next_id;
+ nodes_[event_id].next[c] = next_event_id;
}
- do_add(next_id, value.substr(1));
+ do_add(next_event_id, value.substr(1));
}
void do_dump(td::string path, int v) {
@@ -84,11 +84,11 @@ struct Trie {
return;
}
for (int c = 0; c < 256; c++) {
- auto next_id = nodes_[v].next[c];
- if (next_id == 0) {
+ auto next_event_id = nodes_[v].next[c];
+ if (next_event_id == 0) {
continue;
}
- do_dump(path + static_cast<char>(c), next_id);
+ do_dump(path + static_cast<char>(c), next_event_id);
}
}
};
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
info[0].compressed_size += event.raw_event_.size();
info[event.type_].compressed_size += event.raw_event_.size();
if (event.type_ == ConfigPmcMagic || event.type_ == BinlogPmcMagic) {
- auto key = td::TlParser(event.data_).fetch_string<td::Slice>();
+ auto key = td::TlParser(event.get_data()).fetch_string<td::Slice>();
info[event.type_].compressed_trie.add(key);
}
},
@@ -134,12 +134,13 @@ int main(int argc, char *argv[]) {
info[0].full_size += event.raw_event_.size();
info[event.type_].full_size += event.raw_event_.size();
if (event.type_ == ConfigPmcMagic || event.type_ == BinlogPmcMagic) {
- auto key = td::TlParser(event.data_).fetch_string<td::Slice>();
+ auto key = td::TlParser(event.get_data()).fetch_string<td::Slice>();
info[event.type_].trie.add(key);
}
- LOG(PLAIN) << "LogEvent[" << td::tag("id", td::format::as_hex(event.id_)) << td::tag("type", event.type_)
- << td::tag("flags", event.flags_) << td::tag("size", event.data_.size())
- << td::tag("data", td::format::escaped(event.data_)) << "]\n";
+ LOG(PLAIN) << "LogEvent[" << td::tag("event_id", td::format::as_hex(event.id_))
+ << td::tag("type", event.type_) << td::tag("flags", event.flags_)
+ << td::tag("size", event.get_data().size())
+ << td::tag("data", td::format::escaped(event.get_data())) << "]\n";
})
.ensure();