hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
mst_processor.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_MST_PROPAGATOR_HPP
7 #define IROHA_MST_PROPAGATOR_HPP
8 
9 #include <memory>
10 #include <mutex>
11 #include <rxcpp/rx.hpp>
12 #include "logger/logger.hpp"
15 
16 namespace iroha {
17 
22  class MstProcessor {
23  public:
24  // ---------------------------| user interface |----------------------------
25 
31  void propagateBatch(const DataType &batch);
32 
38  bool batchInStorage(const DataType &batch) const;
39 
43  rxcpp::observable<std::shared_ptr<MstState>> onStateUpdate() const;
44 
49  rxcpp::observable<DataType> onPreparedBatches() const;
50 
54  rxcpp::observable<DataType> onExpiredBatches() const;
55 
56  virtual ~MstProcessor() = default;
57 
58  protected:
59  explicit MstProcessor(logger::Logger log = logger::log("MstProcessor"));
60 
62 
63  private:
64  // ------------------------| inheritance interface |------------------------
65 
69  virtual auto propagateBatchImpl(const DataType &batch)
70  -> decltype(propagateBatch(batch)) = 0;
71 
75  virtual auto onStateUpdateImpl() const -> decltype(onStateUpdate()) = 0;
76 
80  virtual auto onPreparedBatchesImpl() const
81  -> decltype(onPreparedBatches()) = 0;
82 
86  virtual auto onExpiredBatchesImpl() const
87  -> decltype(onExpiredBatches()) = 0;
88 
92  virtual bool batchInStorageImpl(const DataType &batch) const = 0;
93  };
94 } // namespace iroha
95 
96 #endif // IROHA_MST_PROPAGATOR_HPP
MstProcessor(logger::Logger log=logger::log("MstProcessor"))
Definition: mst_processor.cpp:10
std::shared_ptr< spdlog::logger > Logger
Definition: logger.hpp:26
rxcpp::observable< DataType > onExpiredBatches() const
Definition: mst_processor.cpp:25
Definition: block_query.hpp:16
Logger log(const std::string &tag)
Definition: logger.cpp:48
void propagateBatch(const DataType &batch)
Definition: mst_processor.cpp:12
Definition: mst_processor.hpp:22
virtual ~MstProcessor()=default
rxcpp::observable< std::shared_ptr< MstState > > onStateUpdate() const
Definition: mst_processor.cpp:16
bool batchInStorage(const DataType &batch) const
Definition: mst_processor.cpp:29
BatchPtr DataType
Definition: mst_types.hpp:40
rxcpp::observable< DataType > onPreparedBatches() const
Definition: mst_processor.cpp:21
logger::Logger log_
Definition: mst_processor.hpp:61