fix(ecstore): remove dead _buf field from Erasure struct (#3196)

* fix(ecstore): remove dead _buf field from Erasure struct

_buf was allocated in new(), clone(), and Default but never read or written.
Each clone() was allocating block_size bytes (typically 10MB) for nothing.

- Remove _buf from struct, Default, Clone, new_with_options
- 51 erasure tests pass

* fix: remove empty line after doc comment

---------

Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
安正超
2026-06-03 23:40:29 +08:00
committed by GitHub
parent a63aaf933d
commit 0fb02049ac
@@ -308,7 +308,6 @@ where
/// - `encoder`: Optional ReedSolomon encoder instance. /// - `encoder`: Optional ReedSolomon encoder instance.
/// - `block_size`: Block size for each shard. /// - `block_size`: Block size for each shard.
/// - `_id`: Unique identifier for the erasure instance. /// - `_id`: Unique identifier for the erasure instance.
/// - `_buf`: Internal buffer for block operations.
/// ///
/// # Example /// # Example
/// ```ignore /// ```ignore
@@ -326,7 +325,6 @@ pub struct Erasure {
pub block_size: usize, pub block_size: usize,
uses_legacy: bool, uses_legacy: bool,
_id: Uuid, _id: Uuid,
_buf: Vec<u8>,
} }
impl Default for Erasure { impl Default for Erasure {
@@ -339,7 +337,6 @@ impl Default for Erasure {
block_size: 0, block_size: 0,
uses_legacy: false, uses_legacy: false,
_id: Uuid::nil(), _id: Uuid::nil(),
_buf: vec![],
} }
} }
} }
@@ -354,7 +351,6 @@ impl Clone for Erasure {
block_size: self.block_size, block_size: self.block_size,
uses_legacy: self.uses_legacy, uses_legacy: self.uses_legacy,
_id: Uuid::new_v4(), // Generate new ID for clone _id: Uuid::new_v4(), // Generate new ID for clone
_buf: vec![0u8; self.block_size],
} }
} }
} }
@@ -399,7 +395,6 @@ impl Erasure {
legacy_encoder, legacy_encoder,
uses_legacy, uses_legacy,
_id: Uuid::new_v4(), _id: Uuid::new_v4(),
_buf: vec![0u8; block_size],
} }
} }