Skip to content

Commit

Permalink
rename RabinChunker to Chunker
Browse files Browse the repository at this point in the history
  • Loading branch information
Piletskii-Oleg committed May 1, 2024
1 parent 6b72487 commit 241b9b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/bin/filetest.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use chunking::{leap_based, ultra, Chunk};
use chunking::{leap_based, ultra, rabin, Chunk};
use clap::Parser;
use sha3::{Digest, Sha3_256};
use std::collections::HashMap;
Expand All @@ -21,7 +21,7 @@ fn main() {
let (chunks, time) = match cli.algorithm {
Algorithm::Ultra => chunk_file(ultra::Chunker::new(&buf)),
Algorithm::Leap => chunk_file(leap_based::Chunker::new(&buf)),
Algorithm::Rabin => chunk_file(chunking::rabin::RabinChunker::new(&buf))
Algorithm::Rabin => chunk_file(rabin::Chunker::new(&buf))
};

let total_len = chunks.iter().map(|chunk| chunk.len).sum::<usize>();
Expand Down
10 changes: 5 additions & 5 deletions src/rabin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const WIN_MASK: usize = WIN_SIZE - 1;
const WIN_SLIDE_OFFSET: usize = 64;
const WIN_SLIDE_POS: usize = MIN_SIZE - WIN_SLIDE_OFFSET;

pub struct RabinChunker<'a> {
pub struct Chunker<'a> {
buf: &'a [u8],
params: ChunkerParams, // chunker parameters
pos: usize,
Expand All @@ -42,9 +42,9 @@ struct ChunkerParams {
ir: Vec<u64>, // irreducible polynomial, length is 256
}

impl<'a> RabinChunker<'a> {
pub fn new(buf: &'a [u8]) -> RabinChunker {
RabinChunker {
impl<'a> Chunker<'a> {
pub fn new(buf: &'a [u8]) -> Chunker {
Chunker {
buf,
pos: 0,
params: ChunkerParams::new(),
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'a> RabinChunker<'a> {
}
}

impl<'a> Iterator for RabinChunker<'a> {
impl<'a> Iterator for Chunker<'a> {
type Item = Chunk;

fn next(&mut self) -> Option<Self::Item> {
Expand Down

0 comments on commit 241b9b0

Please sign in to comment.