From 9d9252a63856c4604a820cf6ce606fab25dbbd8a Mon Sep 17 00:00:00 2001 From: Ashwin Sekar Date: Wed, 25 Oct 2023 18:26:00 +0000 Subject: [PATCH] pr feedback: add test impl for ErasureConfig --- ledger/src/blockstore.rs | 5 +---- ledger/src/blockstore_meta.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 28d77c0fd72b58..0d185dd499128f 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -7511,10 +7511,7 @@ pub mod tests { let blockstore = Blockstore::open(ledger_path.path()).unwrap(); let erasure_meta_cf = &blockstore.erasure_meta_cf; - let config = ErasureConfig { - num_data: 1, - num_coding: 17, - }; + let config = ErasureConfig::new(1, 17); let erasure_meta_old = ErasureMetaLegacy { set_index: 5, first_coding_index: 8, diff --git a/ledger/src/blockstore_meta.rs b/ledger/src/blockstore_meta.rs index b3848519d9b4ef..8dcbfe0c2c8625 100644 --- a/ledger/src/blockstore_meta.rs +++ b/ledger/src/blockstore_meta.rs @@ -150,8 +150,18 @@ pub struct ErasureMeta { #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] pub(crate) struct ErasureConfig { - pub(crate) num_data: usize, - pub(crate) num_coding: usize, + num_data: usize, + num_coding: usize, +} + +#[cfg(test)] +impl ErasureConfig { + pub(crate) fn new(num_data: usize, num_coding: usize) -> Self { + ErasureConfig { + num_data, + num_coding, + } + } } #[derive(Deserialize, Serialize)]