hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
mutable_storage.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_MUTABLE_STORAGE_HPP
7 #define IROHA_MUTABLE_STORAGE_HPP
8 
9 #include <functional>
10 
11 #include <rxcpp/rx-observable-fwd.hpp>
14 #include "common/result.hpp"
16 
17 namespace shared_model {
18  namespace interface {
19  class Block;
20  } // namespace interface
21 } // namespace shared_model
22 
23 namespace iroha {
24  struct LedgerState;
25 
26  namespace ametsuchi {
27 
28  class WsvQuery;
29 
35  public:
42  using MutableStoragePredicate = std::function<bool(
43  std::shared_ptr<const shared_model::interface::Block>,
44  const LedgerState &)>;
45 
46  struct CommitResult {
47  std::shared_ptr<const LedgerState> ledger_state;
48  std::unique_ptr<BlockStorage> block_storage;
49  };
50 
55  virtual bool apply(
56  std::shared_ptr<const shared_model::interface::Block> block) = 0;
57 
66  virtual bool apply(
67  rxcpp::observable<std::shared_ptr<shared_model::interface::Block>>
68  blocks,
69  MutableStoragePredicate predicate) = 0;
70 
73  commit() && = 0;
74 
75  virtual ~MutableStorage() = default;
76  };
77 
78  } // namespace ametsuchi
79 } // namespace iroha
80 
81 #endif // IROHA_MUTABLE_STORAGE_HPP
decltype(auto) constexpr apply(Tuple &&t, F &&f)
apply F to Tuple
Definition: soci_utils.hpp:72
Definition: result_fwd.hpp:27
Definition: mutable_storage.hpp:46
std::function< bool(std::shared_ptr< const shared_model::interface::Block >, const LedgerState &)> MutableStoragePredicate
Definition: mutable_storage.hpp:44
Definition: block_query.hpp:15
Definition: mutable_storage.hpp:34
std::shared_ptr< const LedgerState > ledger_state
Definition: mutable_storage.hpp:47
Definition: ledger_state.hpp:23
Definition: command_executor.hpp:12
std::unique_ptr< BlockStorage > block_storage
Definition: mutable_storage.hpp:48