/*
This file is part of TON Blockchain Library.
TON Blockchain Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
TON Blockchain Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with TON Blockchain Library. If not, see .
Copyright 2019-2020 Telegram Systems LLP
*/
#pragma once
#include "td/actor/actor.h"
#include "validator/interfaces/validator-manager.h"
#include "validator/db/package.hpp"
namespace ton {
namespace validator {
class ArchiveImporter : public td::actor::Actor {
public:
ArchiveImporter(std::string path, td::Ref state, BlockSeqno shard_client_seqno,
td::Ref opts, td::actor::ActorId manager,
td::Promise> promise);
void start_up() override;
void abort_query(td::Status error);
void finish_query();
void check_masterchain_block(BlockSeqno seqno);
void checked_masterchain_proof(BlockHandle handle, td::Ref data);
void applied_masterchain_block(BlockHandle handle);
void got_new_materchain_state(td::Ref state);
void checked_all_masterchain_blocks(BlockSeqno seqno);
void check_next_shard_client_seqno(BlockSeqno seqno);
void checked_shard_client_seqno(BlockSeqno seqno);
void got_masterchain_state(td::Ref state);
void apply_shard_block(BlockIdExt block_id, BlockIdExt masterchain_block_id, td::Promise promise);
void apply_shard_block_cont1(BlockHandle handle, BlockIdExt masterchain_block_id, td::Promise promise);
void apply_shard_block_cont2(BlockHandle handle, BlockIdExt masterchain_block_id, td::Promise promise);
void apply_shard_block_cont3(BlockHandle handle, BlockIdExt masterchain_block_id, td::Promise promise);
void check_shard_block_applied(BlockIdExt block_id, td::Promise promise);
private:
std::string path_;
td::Ref state_;
BlockSeqno shard_client_seqno_;
td::Ref opts_;
std::shared_ptr package_;
td::actor::ActorId manager_;
td::Promise> promise_;
std::map masterchain_blocks_;
std::map> blocks_;
};
} // namespace validator
} // namespace ton