1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Rename private ext msg overlays to custom overlays, change interface a bit (#952)

Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
EmelyanenkoK 2024-04-01 18:24:08 +03:00 committed by GitHub
parent 0434eadc1f
commit f7907bdd58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 121 additions and 125 deletions

View file

@ -1110,69 +1110,69 @@ td::Status SetExtMessagesBroadcastDisabledQuery::receive(td::BufferSlice data) {
return td::Status::OK();
}
td::Status AddPrivateExtMsgOverlayQuery::run() {
td::Status AddCustomOverlayQuery::run() {
TRY_RESULT_ASSIGN(file_name_, tokenizer_.get_token<std::string>());
TRY_STATUS(tokenizer_.check_endl());
return td::Status::OK();
}
td::Status AddPrivateExtMsgOverlayQuery::send() {
td::Status AddCustomOverlayQuery::send() {
TRY_RESULT(data, td::read_file(file_name_));
TRY_RESULT(json, td::json_decode(data.as_slice()));
auto overlay = ton::create_tl_object<ton::ton_api::engine_validator_privateExtMsgOverlay>();
auto overlay = ton::create_tl_object<ton::ton_api::engine_validator_customOverlay>();
TRY_STATUS(ton::ton_api::from_json(*overlay, json.get_object()));
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_addPrivateExtMsgOverlay>(std::move(overlay));
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_addCustomOverlay>(std::move(overlay));
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status AddPrivateExtMsgOverlayQuery::receive(td::BufferSlice data) {
td::Status AddCustomOverlayQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_success>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << "success\n";
return td::Status::OK();
}
td::Status DelPrivateExtMsgOverlayQuery::run() {
td::Status DelCustomOverlayQuery::run() {
TRY_RESULT_ASSIGN(name_, tokenizer_.get_token<std::string>());
TRY_STATUS(tokenizer_.check_endl());
return td::Status::OK();
}
td::Status DelPrivateExtMsgOverlayQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_delPrivateExtMsgOverlay>(name_);
td::Status DelCustomOverlayQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_delCustomOverlay>(name_);
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status DelPrivateExtMsgOverlayQuery::receive(td::BufferSlice data) {
td::Status DelCustomOverlayQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_success>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << "success\n";
return td::Status::OK();
}
td::Status ShowPrivateExtMsgOverlaysQuery::run() {
td::Status ShowCustomOverlaysQuery::run() {
TRY_STATUS(tokenizer_.check_endl());
return td::Status::OK();
}
td::Status ShowPrivateExtMsgOverlaysQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_showPrivateExtMsgOverlays>();
td::Status ShowCustomOverlaysQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_showCustomOverlays>();
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status ShowPrivateExtMsgOverlaysQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(
f, ton::fetch_tl_object<ton::ton_api::engine_validator_privateExtMsgOverlaysConfig>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << f->overlays_.size() << " private overlays:\n\n";
td::Status ShowCustomOverlaysQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_customOverlaysConfig>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << f->overlays_.size() << " custom overlays:\n\n";
for (const auto &overlay : f->overlays_) {
td::TerminalIO::out() << "Overlay \"" << overlay->name_ << "\": " << overlay->nodes_.size() << " nodes\n";
for (const auto &node : overlay->nodes_) {
td::TerminalIO::out() << " " << node->adnl_id_
<< (node->sender_ ? (PSTRING() << " (sender, p=" << node->sender_priority_ << ")") : "")
<< (node->msg_sender_ ? (PSTRING() << " (sender, p=" << node->msg_sender_priority_ << ")")
: "")
<< "\n";
}
td::TerminalIO::out() << "\n";