hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
storage.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_AMETSUCHI_H
7 #define IROHA_AMETSUCHI_H
8 
9 #include <vector>
10 
11 #include <rxcpp/rx.hpp>
17 #include "common/result.hpp"
18 
19 namespace shared_model {
20  namespace interface {
21  class Block;
22  }
23 } // namespace shared_model
24 
25 namespace iroha {
26 
27  namespace ametsuchi {
28 
29  class BlockQuery;
30  class WsvQuery;
31 
36  class Storage : public TemporaryFactory,
37  public MutableFactory,
38  public PeerQueryFactory,
39  public BlockQueryFactory,
40  public QueryExecutorFactory {
41  public:
42  virtual std::shared_ptr<WsvQuery> getWsvQuery() const = 0;
43 
44  virtual std::shared_ptr<BlockQuery> getBlockQuery() const = 0;
45 
51  virtual bool insertBlock(const shared_model::interface::Block &block) = 0;
52 
58  virtual bool insertBlocks(
59  const std::vector<std::shared_ptr<shared_model::interface::Block>>
60  &blocks) = 0;
61 
66  virtual rxcpp::observable<std::shared_ptr<shared_model::interface::Block>>
67  on_commit() = 0;
68 
72  virtual void reset() = 0;
73 
78  virtual void dropStorage() = 0;
79 
80  virtual void freeConnections() = 0;
81 
82  virtual ~Storage() = default;
83  };
84 
85  } // namespace ametsuchi
86 
87 } // namespace iroha
88 
89 #endif // IROHA_AMETSUCHI_H
Definition: temporary_factory.hpp:17
Definition: block_query_factory.hpp:15
Definition: storage.hpp:36
Definition: block.hpp:15
Definition: query_executor_factory.hpp:17
Definition: block_query.hpp:16
Definition: peer_query_factory.hpp:15
Definition: command_executor.hpp:12
Definition: mutable_factory.hpp:26