refactor(ecstore): add mmap copy disk read name (#4061)

This commit is contained in:
Zhengchao An
2026-06-29 21:18:41 +08:00
committed by GitHub
parent 9567e7b3be
commit a7dd9603e9
7 changed files with 53 additions and 30 deletions
+3 -3
View File
@@ -149,7 +149,7 @@ async fn open_disk_reader(
) -> disk::error::Result<FileReader> {
if use_mmap_read && disk.is_local() {
let start = Instant::now();
match disk.read_file_zero_copy(bucket, path, offset, length).await {
match disk.read_file_mmap_copy(bucket, path, offset, length).await {
Ok(bytes) => {
let duration_ms = start.elapsed().as_secs_f64() * 1000.0;
@@ -201,7 +201,7 @@ fn bitrot_encoded_range(offset: usize, length: usize, shard_size: usize, checksu
/// * `shard_size` - Shard size for erasure coding
/// * `checksum_algo` - Hash algorithm for bitrot verification
/// * `skip_verify` - If true, skip checksum verification
/// * `use_mmap_read` - If true, use zero-copy read (mmap on Unix)
/// * `use_mmap_read` - If true, use mmap-copy read (mmap on Unix)
#[allow(clippy::too_many_arguments)]
pub async fn create_bitrot_reader(
inline_data: Option<&[u8]>,
@@ -360,7 +360,7 @@ mod tests {
let shard_size = 16;
let checksum_algo = HashAlgorithm::HighwayHash256S;
// Test with zero-copy enabled (should work the same for inline data)
// Test with mmap-copy enabled (should work the same for inline data)
let result = create_bitrot_reader(
Some(test_data),
None,