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;
63 std::unique_ptr<MutableStorage> createMutableStorage(
64 std::shared_ptr<CommandExecutor> command_executor)
override;
66 boost::optional<std::shared_ptr<PeerQuery>> createPeerQuery()
69 boost::optional<std::shared_ptr<BlockQuery>> createBlockQuery()
72 boost::optional<std::unique_ptr<SettingQuery>> createSettingQuery()
77 std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
78 std::shared_ptr<shared_model::interface::QueryResponseFactory>
79 response_factory)
const override;
82 std::shared_ptr<const shared_model::interface::Block> block)
override;
87 std::unique_ptr<MutableStorage> createMutableStorage(
88 std::shared_ptr<CommandExecutor> command_executor,
91 void resetPeers()
override;
95 boost::optional<std::shared_ptr<const iroha::LedgerState>>
96 getLedgerState()
const override;
98 void freeConnections()
override;
101 std::unique_ptr<MutableStorage> mutable_storage)
override;
103 bool preparedCommitEnabled()
const override;
106 std::shared_ptr<const shared_model::interface::Block> block)
override;
108 std::shared_ptr<WsvQuery> getWsvQuery()
const override;
110 std::shared_ptr<BlockQuery> getBlockQuery()
const override;
112 rxcpp::observable<std::shared_ptr<const shared_model::interface::Block>>
113 on_commit()
override;
115 void prepareBlock(std::unique_ptr<TemporaryWsv> wsv)
override;
121 boost::optional<std::shared_ptr<const iroha::LedgerState>>
124 std::shared_ptr<BlockStorage> block_store,
125 std::shared_ptr<PoolWrapper> pool_wrapper,
126 std::shared_ptr<shared_model::interface::PermissionToString>
128 std::shared_ptr<PendingTransactionStorage> pending_txs_storage,
129 std::shared_ptr<shared_model::interface::QueryResponseFactory>
130 query_response_factory,
131 std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory,
133 std::optional<std::reference_wrapper<const VmCaller>> vm_caller,
139 friend class ::iroha::ametsuchi::AmetsuchiTest;
145 std::shared_ptr<const shared_model::interface::Block> block);
150 void tryRollback(soci::session &session);
152 std::shared_ptr<BlockStorage> block_store_;
154 std::shared_ptr<PoolWrapper> pool_wrapper_;
157 std::shared_ptr<soci::connection_pool> &connection_;
159 rxcpp::composite_subscription notifier_lifetime_;
160 rxcpp::subjects::subject<
161 std::shared_ptr<const shared_model::interface::Block>>
164 std::shared_ptr<shared_model::interface::PermissionToString>
167 std::shared_ptr<PendingTransactionStorage> pending_txs_storage_;
169 std::shared_ptr<shared_model::interface::QueryResponseFactory>
170 query_response_factory_;
172 std::unique_ptr<BlockStorageFactory> temporary_block_storage_factory_;
174 std::optional<std::reference_wrapper<const VmCaller>> vm_caller_ref_;
179 mutable std::shared_timed_mutex drop_mutex_;
181 const size_t pool_size_;
183 bool prepared_blocks_enabled_;
185 std::atomic<bool> block_is_prepared_;
187 std::string prepared_block_name_;
189 boost::optional<std::shared_ptr<const iroha::LedgerState>> ledger_state_;
194 #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:18
Definition: command_executor.hpp:12
Definition: storage_impl.hpp:41