src/backup/index.rs: rename ChunkListReader into DigestListEncoder
This commit is contained in:
parent
ee53955f52
commit
7f3d2ffab9
@ -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);
|
||||
|
||||
|
@ -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"); }
|
||||
|
Loading…
Reference in New Issue
Block a user