src/backup/index.rs: rename ChunkListReader into DigestListEncoder

This commit is contained in:
Dietmar Maurer 2019-05-21 12:28:44 +02:00
parent ee53955f52
commit 7f3d2ffab9
2 changed files with 5 additions and 5 deletions

View File

@ -381,7 +381,7 @@ fn dynamic_chunk_index(
env.register_chunk(digest, size)?;
}
let reader = ChunkListReader::new(Box::new(index));
let reader = DigestListEncoder::new(Box::new(index));
let stream = WrappedReaderStream::new(reader);

View File

@ -7,16 +7,16 @@ pub trait IndexFile: Send {
fn index_digest(&self, pos: usize) -> Option<&[u8; 32]>;
}
/// This struct can read the list of chunks from an `IndexFile`
/// Encode digest list from an `IndexFile` into a binary stream
///
/// The reader simply returns a birary stream of 32 byte digest values.
pub struct ChunkListReader {
pub struct DigestListEncoder {
index: Box<dyn IndexFile>,
pos: usize,
count: usize,
}
impl ChunkListReader {
impl DigestListEncoder {
pub fn new(index: Box<dyn IndexFile>) -> Self {
let count = index.index_count();
@ -24,7 +24,7 @@ impl ChunkListReader {
}
}
impl std::io::Read for ChunkListReader {
impl std::io::Read for DigestListEncoder {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
if buf.len() < 32 { panic!("read buffer too small"); }