hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
rocksdb_storage_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ROCKSDB_STORAGE_IMPL_HPP
7 #define IROHA_ROCKSDB_STORAGE_IMPL_HPP
8 
10 
11 namespace shared_model {
12  namespace interface {
13  class QueryResponseFactory;
14  } // namespace interface
15 } // namespace shared_model
16 namespace iroha {
17 
18  class PendingTransactionStorage;
19 
20  namespace ametsuchi {
21 
22  struct RocksDBPort;
23  class AmetsuchiTest;
24  class PostgresOptions;
25  class VmCaller;
26  class RocksDbCommon;
27  struct RocksDBContext;
28 
29  class RocksDbStorageImpl final : public StorageBase {
30  public:
32  create(
33  std::shared_ptr<RocksDBContext> db_context,
34  std::shared_ptr<shared_model::interface::PermissionToString>
35  perm_converter,
36  std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
37  std::shared_ptr<shared_model::interface::QueryResponseFactory>
38  query_response_factory,
39  std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory,
40  std::shared_ptr<BlockStorage> persistent_block_storage,
41  std::optional<std::reference_wrapper<const VmCaller>> vm_caller_ref,
42  std::function<void(
43  std::shared_ptr<shared_model::interface::Block const>)> callback,
44  logger::LoggerManagerTreePtr log_manager);
45 
47  createCommandExecutor() override;
48 
49  std::unique_ptr<TemporaryWsv> createTemporaryWsv(
50  std::shared_ptr<CommandExecutor> command_executor) override;
51 
52  boost::optional<std::unique_ptr<SettingQuery>> createSettingQuery()
53  const override;
54 
56  createQueryExecutor(
57  std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
58  std::shared_ptr<shared_model::interface::QueryResponseFactory>
59  response_factory) const override;
60 
62  const shared_model::interface::Peer &peer) override;
63 
65  createMutableStorage(std::shared_ptr<CommandExecutor> command_executor,
66  BlockStorageFactory &storage_factory) override;
67 
69  createMutableStorage(
70  std::shared_ptr<CommandExecutor> command_executor) override;
71 
72  iroha::expected::Result<void, std::string> resetPeers() override;
73 
74  void freeConnections() override;
75 
76  CommitResult commitPrepared(
77  std::shared_ptr<const shared_model::interface::Block> block) override;
78 
79  std::shared_ptr<WsvQuery> getWsvQuery() const override;
80 
81  std::shared_ptr<BlockQuery> getBlockQuery() const override;
82 
83  void prepareBlock(std::unique_ptr<TemporaryWsv> wsv) override;
84 
85  ~RocksDbStorageImpl() override = default;
86 
87  protected:
89  std::shared_ptr<RocksDBContext> db_context,
90  boost::optional<std::shared_ptr<const iroha::LedgerState>>
91  ledger_state,
92  std::shared_ptr<BlockStorage> block_store,
93  std::shared_ptr<shared_model::interface::PermissionToString>
94  perm_converter,
95  std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
96  std::shared_ptr<shared_model::interface::QueryResponseFactory>
97  query_response_factory,
98  std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory,
99  std::optional<std::reference_wrapper<const VmCaller>> vm_caller,
100  std::function<void(
101  std::shared_ptr<shared_model::interface::Block const>)> callback,
102  logger::LoggerManagerTreePtr log_manager);
103 
104  private:
106 
107  friend class ::iroha::ametsuchi::AmetsuchiTest;
108  std::shared_ptr<RocksDBContext> db_context_;
109  };
110 
111  } // namespace ametsuchi
112 } // namespace iroha
113 
114 #endif // IROHA_ROCKSDB_STORAGE_IMPL_HPP
Definition: block_query.hpp:17
Definition: peer.hpp:20
Definition: result_fwd.hpp:27
Definition: block_query.hpp:15
Definition: rocksdb_storage_impl.hpp:29
std::shared_ptr< LoggerManagerTree > LoggerManagerTreePtr
Definition: logger_manager_fwd.hpp:14
Definition: block_storage_factory.hpp:19
Definition: storage_base.hpp:40
Definition: command_executor.hpp:13