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 
17 #include "common/result_fwd.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 BlockStorageFactory;
30  class BlockQuery;
31  class WsvQuery;
32 
37  class Storage : public TemporaryFactory,
38  public MutableFactory,
39  public PeerQueryFactory,
40  public BlockQueryFactory,
41  public QueryExecutorFactory,
42  public SettingQueryFactory {
43  public:
44  virtual std::shared_ptr<WsvQuery> getWsvQuery() const = 0;
45 
46  virtual std::shared_ptr<BlockQuery> getBlockQuery() const = 0;
47 
54  std::shared_ptr<const shared_model::interface::Block> block) = 0;
55 
61  createCommandExecutor() = 0;
62 
68  virtual expected::Result<void, std::string> insertPeer(
69  const shared_model::interface::Peer &peer) = 0;
70 
71  using MutableFactory::createMutableStorage;
72 
78  std::string>
79  createMutableStorage(std::shared_ptr<CommandExecutor> command_executor,
80  BlockStorageFactory &storage_factory) = 0;
81 
85  virtual expected::Result<void, std::string> resetPeers() = 0;
86 
90  virtual expected::Result<void, std::string> dropBlockStorage() = 0;
91 
92  virtual boost::optional<std::shared_ptr<const iroha::LedgerState>>
93  getLedgerState() const = 0;
94 
95  virtual void freeConnections() = 0;
96 
97  virtual ~Storage() = default;
98  };
99 
100  } // namespace ametsuchi
101 
102 } // namespace iroha
103 
104 #endif // IROHA_AMETSUCHI_H
Definition: block_query.hpp:17
Definition: temporary_factory.hpp:18
Definition: setting_query_factory.hpp:15
Definition: peer.hpp:20
Definition: result_fwd.hpp:27
Definition: block_query_factory.hpp:15
Definition: storage.hpp:37
Definition: query_executor_factory.hpp:18
Definition: block_query.hpp:15
Definition: peer_query_factory.hpp:15
Definition: block_storage_factory.hpp:19
Definition: command_executor.hpp:13
Definition: mutable_factory.hpp:27