hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
in_memory_block_storage.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_IN_MEMORY_BLOCK_STORAGE_HPP
7 #define IROHA_IN_MEMORY_BLOCK_STORAGE_HPP
8 
10 
11 #include <map>
12 
13 namespace iroha {
14  namespace ametsuchi {
15 
20  public:
21  bool insert(
22  std::shared_ptr<const shared_model::interface::Block> block) override;
23 
24  boost::optional<std::unique_ptr<shared_model::interface::Block>> fetch(
25  shared_model::interface::types::HeightType height) const override;
26 
27  size_t size() const override;
28 
29  void reload() override;
30 
31  void clear() override;
32 
34  FunctionType function) const override;
35 
36  private:
38  std::shared_ptr<const shared_model::interface::Block>>
39  block_store_;
40  };
41 
42  } // namespace ametsuchi
43 } // namespace iroha
44 
45 #endif // IROHA_IN_MEMORY_BLOCK_STORAGE_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
std::function< expected::Result< void, std::string >(std::shared_ptr< const shared_model::interface::Block >)> FunctionType
type of function which can be applied to the elements of the storage
Definition: block_storage.hpp:56
Definition: block_storage.hpp:23
Definition: in_memory_block_storage.hpp:19
bool insert(std::shared_ptr< const shared_model::interface::Block > block) override
Definition: in_memory_block_storage.cpp:10
void clear() override
Definition: in_memory_block_storage.cpp:34
Definition: result_fwd.hpp:27
Definition: block_query.hpp:15
expected::Result< void, std::string > forEach(FunctionType function) const override
Definition: in_memory_block_storage.cpp:38
boost::optional< std::unique_ptr< shared_model::interface::Block > > fetch(shared_model::interface::types::HeightType height) const override
Definition: in_memory_block_storage.cpp:17
void reload() override
Definition: in_memory_block_storage.cpp:30
size_t size() const override
Definition: in_memory_block_storage.cpp:27