Ethereum  PoC-8
The C++ Implementation of Ethereum
SnapshotImporter.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
21 #pragma once
22 
23 #include <libdevcore/Common.h>
24 #include <libdevcore/Exceptions.h>
25 #include <libdevcore/FixedHash.h>
26 #include <libdevcore/Log.h>
27 
28 namespace dev
29 {
30 
31 namespace eth
32 {
33 
34 class Client;
35 class BlockChainImporterFace;
36 class SnapshotStorageFace;
37 class StateImporterFace;
38 
40 {
41 public:
42  SnapshotImporter(StateImporterFace& _stateImporter, BlockChainImporterFace& _bcImporter): m_stateImporter(_stateImporter), m_blockChainImporter(_bcImporter) {}
43 
44  void import(SnapshotStorageFace const& _snapshotStorage, h256 const& _genesisHash);
45 
46 private:
47  void importStateChunks(SnapshotStorageFace const& _snapshotStorage, h256s const& _stateChunkHashes, h256 const& _stateRoot);
48  void importBlockChunks(SnapshotStorageFace const& _snapshotStorage, h256s const& _blockChunkHashes);
49 
50  StateImporterFace& m_stateImporter;
51  BlockChainImporterFace& m_blockChainImporter;
52 
53  Logger m_logger{createLogger(VerbosityInfo, "snap")};
54 };
55 
56 }
57 }
dev::eth::SnapshotImporter::SnapshotImporter
SnapshotImporter(StateImporterFace &_stateImporter, BlockChainImporterFace &_bcImporter)
Definition: SnapshotImporter.h:42
FixedHash.h
dev::eth::BlockChainImporterFace
Definition: BlockChainImporter.h:39
dev::eth::SnapshotStorageFace
Definition: SnapshotStorage.h:42
dev::FixedHash< 32 >
dev::VerbosityInfo
@ VerbosityInfo
Definition: Log.h:70
dev::h256s
std::vector< h256 > h256s
Definition: FixedHash.h:361
dev::Logger
boost::log::sources::severity_channel_logger<> Logger
Definition: Log.h:124
Common.h
dev::createLogger
Logger createLogger(int _severity, std::string const &_channel)
Definition: Log.h:125
Exceptions.h
dev::eth::SnapshotImporter
Definition: SnapshotImporter.h:40
dev
Definition: Address.cpp:21
dev::eth::StateImporterFace
Definition: StateImporter.h:40
Log.h