Kagome
Polkadot Runtime Engine in C++17
store_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_PARACHAIN_AVAILABILITY_STORE_STORE_IMPL_HPP
7 #define KAGOME_PARACHAIN_AVAILABILITY_STORE_STORE_IMPL_HPP
8 
10 
11 #include <unordered_map>
12 
13 namespace kagome::parachain {
15  public:
16  ~AvailabilityStoreImpl() override = default;
17 
18  bool hasChunk(const CandidateHash &candidate_hash,
19  ValidatorIndex index) override;
20  bool hasPov(const CandidateHash &candidate_hash) override;
21  bool hasData(const CandidateHash &candidate_hash) override;
22  std::optional<ErasureChunk> getChunk(const CandidateHash &candidate_hash,
23  ValidatorIndex index) override;
24  std::optional<ParachainBlock> getPov(
25  const CandidateHash &candidate_hash) override;
26  void putChunk(const CandidateHash &candidate_hash,
27  const ErasureChunk &chunk) override;
28  void putPov(const CandidateHash &candidate_hash,
29  const ParachainBlock &pov) override;
30  void putData(const CandidateHash &candidate_hash,
31  const PersistedValidationData &data) override;
32 
33  private:
34  struct PerCandidate {
35  std::unordered_map<ValidatorIndex, ErasureChunk> chunks;
36  std::optional<ParachainBlock> pov;
37  std::optional<PersistedValidationData> data;
38  };
39 
40  std::unordered_map<CandidateHash, PerCandidate> per_candidate_;
41  };
42 } // namespace kagome::parachain
43 
44 #endif // KAGOME_PARACHAIN_AVAILABILITY_STORE_STORE_IMPL_HPP
network::ValidatorIndex ValidatorIndex
Definition: store.hpp:19
std::unordered_map< ValidatorIndex, ErasureChunk > chunks
Definition: store_impl.hpp:35
std::unordered_map< CandidateHash, PerCandidate > per_candidate_
Definition: store_impl.hpp:40
bool hasPov(const CandidateHash &candidate_hash) override
Definition: store_impl.cpp:18
void putChunk(const CandidateHash &candidate_hash, const ErasureChunk &chunk) override
Definition: store_impl.cpp:57
bool hasData(const CandidateHash &candidate_hash) override
Definition: store_impl.cpp:26
network::CandidateHash CandidateHash
Definition: store.hpp:18
void putData(const CandidateHash &candidate_hash, const PersistedValidationData &data) override
Definition: store_impl.cpp:67
bool hasChunk(const CandidateHash &candidate_hash, ValidatorIndex index) override
Definition: store_impl.cpp:9
std::optional< ParachainBlock > getPov(const CandidateHash &candidate_hash) override
Definition: store_impl.cpp:49
Stores ErasureChunk, PoV and PersistedValidationData.
Definition: store.hpp:16
A chunk of erasure-encoded block data.
std::optional< PersistedValidationData > data
Definition: store_impl.hpp:37
std::optional< ErasureChunk > getChunk(const CandidateHash &candidate_hash, ValidatorIndex index) override
Definition: store_impl.cpp:35
void putPov(const CandidateHash &candidate_hash, const ParachainBlock &pov) override
Definition: store_impl.cpp:62