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::shared_ptr<const shared_model::interface::Block>>
26 
27  size_t size() const override;
28 
29  void clear() override;
30 
31  void forEach(FunctionType function) const override;
32 
33  private:
35  std::shared_ptr<const shared_model::interface::Block>>
36  block_store_;
37  };
38 
39  } // namespace ametsuchi
40 } // namespace iroha
41 
42 #endif // IROHA_IN_MEMORY_BLOCK_STORAGE_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:43
void forEach(FunctionType function) const override
Definition: in_memory_block_storage.cpp:35
Definition: block_storage.hpp:22
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:31
boost::optional< std::shared_ptr< const shared_model::interface::Block > > fetch(shared_model::interface::types::HeightType height) const override
Definition: in_memory_block_storage.cpp:17
Definition: block_query.hpp:14
std::function< void(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:51
size_t size() const override
Definition: in_memory_block_storage.cpp:27