mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Availability store pruning (#1820)
* Initial commit * Move tests to separate module * Move timestamps to the newtype * Change idx name * Use Duration for consts and update chunk records * Ordering::Equal * Update node/core/av-store/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * put_ methods do the array sorting * Fix get_block_number * Change StoreChunk message type and relay parent method * Add chunk tests * Fix block number computation for StoreChunk * Duration instead of u64 everywhere * Add a clarifying comment Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
@@ -305,7 +305,18 @@ pub enum AvailabilityStoreMessage {
|
||||
/// Store an `ErasureChunk` in the AV store.
|
||||
///
|
||||
/// Return `Ok(())` if the store operation succeeded, `Err(())` if it failed.
|
||||
StoreChunk(Hash, ValidatorIndex, ErasureChunk, oneshot::Sender<Result<(), ()>>),
|
||||
StoreChunk {
|
||||
/// A hash of the candidate this chunk belongs to.
|
||||
candidate_hash: Hash,
|
||||
/// A relevant relay parent.
|
||||
relay_parent: Hash,
|
||||
/// The index of the validator this chunk belongs to.
|
||||
validator_index: ValidatorIndex,
|
||||
/// The chunk itself.
|
||||
chunk: ErasureChunk,
|
||||
/// Sending side of the channel to send result to.
|
||||
tx: oneshot::Sender<Result<(), ()>>,
|
||||
},
|
||||
|
||||
/// Store a `AvailableData` in the AV store.
|
||||
/// If `ValidatorIndex` is present store corresponding chunk also.
|
||||
@@ -315,15 +326,10 @@ pub enum AvailabilityStoreMessage {
|
||||
}
|
||||
|
||||
impl AvailabilityStoreMessage {
|
||||
/// If the current variant contains the relay parent hash, return it.
|
||||
/// In fact, none of the AvailabilityStore messages assume a particular relay parent.
|
||||
pub fn relay_parent(&self) -> Option<Hash> {
|
||||
match self {
|
||||
Self::QueryAvailableData(hash, _) => Some(*hash),
|
||||
Self::QueryDataAvailability(hash, _) => Some(*hash),
|
||||
Self::QueryChunk(hash, _, _) => Some(*hash),
|
||||
Self::QueryChunkAvailability(hash, _, _) => Some(*hash),
|
||||
Self::StoreChunk(hash, _, _, _) => Some(*hash),
|
||||
Self::StoreAvailableData(hash, _, _, _, _) => Some(*hash),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user