6 #ifndef IROHA_STORAGE_IMPL_HPP 7 #define IROHA_STORAGE_IMPL_HPP 12 #include <shared_mutex> 14 #include <soci/soci.h> 15 #include <boost/optional.hpp> 16 #include <rxcpp/rx-lite.hpp> 28 class QueryResponseFactory;
33 class PendingTransactionStorage;
38 class PostgresOptions;
45 std::shared_ptr<PoolWrapper> pool_wrapper,
46 std::shared_ptr<shared_model::interface::PermissionToString>
48 std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
49 std::shared_ptr<shared_model::interface::QueryResponseFactory>
50 query_response_factory,
51 std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory,
52 std::shared_ptr<BlockStorage> persistent_block_storage,
53 std::optional<std::reference_wrapper<const VmCaller>> vm_caller_ref,
55 size_t pool_size = 10);
58 createCommandExecutor()
override;
60 std::unique_ptr<TemporaryWsv> createTemporaryWsv(
61 std::shared_ptr<CommandExecutor> command_executor)
override;
65 std::shared_ptr<CommandExecutor> command_executor)
override;
67 boost::optional<std::shared_ptr<PeerQuery>> createPeerQuery()
70 boost::optional<std::shared_ptr<BlockQuery>> createBlockQuery()
73 boost::optional<std::unique_ptr<SettingQuery>> createSettingQuery()
78 std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
79 std::shared_ptr<shared_model::interface::QueryResponseFactory>
80 response_factory)
const override;
83 std::shared_ptr<const shared_model::interface::Block> block)
override;
89 createMutableStorage(std::shared_ptr<CommandExecutor> command_executor,
92 void resetPeers()
override;
96 boost::optional<std::shared_ptr<const iroha::LedgerState>>
97 getLedgerState()
const override;
99 void freeConnections()
override;
102 std::unique_ptr<MutableStorage> mutable_storage)
override;
104 bool preparedCommitEnabled()
const override;
107 std::shared_ptr<const shared_model::interface::Block> block)
override;
109 std::shared_ptr<WsvQuery> getWsvQuery()
const override;
111 std::shared_ptr<BlockQuery> getBlockQuery()
const override;
113 rxcpp::observable<std::shared_ptr<const shared_model::interface::Block>>
114 on_commit()
override;
116 void prepareBlock(std::unique_ptr<TemporaryWsv> wsv)
override;
122 boost::optional<std::shared_ptr<const iroha::LedgerState>>
125 std::shared_ptr<BlockStorage> block_store,
126 std::shared_ptr<PoolWrapper> pool_wrapper,
127 std::shared_ptr<shared_model::interface::PermissionToString>
129 std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
130 std::shared_ptr<shared_model::interface::QueryResponseFactory>
131 query_response_factory,
132 std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory,
134 std::optional<std::reference_wrapper<const VmCaller>> vm_caller,
140 friend class ::iroha::ametsuchi::AmetsuchiTest;
146 std::shared_ptr<const shared_model::interface::Block> block);
151 void tryRollback(soci::session &session);
153 std::shared_ptr<BlockStorage> block_store_;
155 std::shared_ptr<PoolWrapper> pool_wrapper_;
158 std::shared_ptr<soci::connection_pool> &connection_;
160 rxcpp::composite_subscription notifier_lifetime_;
161 rxcpp::subjects::subject<
162 std::shared_ptr<const shared_model::interface::Block>>
165 std::shared_ptr<shared_model::interface::PermissionToString>
168 std::shared_ptr<PendingTransactionStorage> pending_txs_storage_;
170 std::shared_ptr<shared_model::interface::QueryResponseFactory>
171 query_response_factory_;
173 std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory_;
175 std::optional<std::reference_wrapper<const VmCaller>> vm_caller_ref_;
180 mutable std::shared_timed_mutex drop_mutex_;
182 const size_t pool_size_;
184 bool prepared_blocks_enabled_;
186 std::atomic<bool> block_is_prepared_;
188 std::string prepared_block_name_;
190 boost::optional<std::shared_ptr<const iroha::LedgerState>> ledger_state_;
195 #endif // IROHA_STORAGE_IMPL_HPP
Definition: postgres_options.hpp:19
Definition: result_fwd.hpp:27
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: storage.hpp:38
Definition: block_query.hpp:15
std::shared_ptr< LoggerManagerTree > LoggerManagerTreePtr
Definition: logger_manager_fwd.hpp:14
Definition: block_storage_factory.hpp:19
Definition: command_executor.hpp:12
Definition: storage_impl.hpp:41