Renamed EncryptedDiskReader to EncryptedReader

This commit is contained in:
Edward Shen 2021-07-14 13:32:26 -04:00
parent 7ce974b4f9
commit 53015e116f
Signed by: edward
GPG key ID: 19182661E818369F

8
src/cache/fs.rs vendored
View file

@ -104,7 +104,7 @@ async fn read_file(
debug!("header bytes: {:x?}", nonce_bytes); debug!("header bytes: {:x?}", nonce_bytes);
maybe_header = Some(*XNonce::from_slice(&nonce_bytes)); maybe_header = Some(*XNonce::from_slice(&nonce_bytes));
reader = Some(Box::pin(BufReader::new(EncryptedDiskReader::new( reader = Some(Box::pin(BufReader::new(EncryptedReader::new(
file, file,
XNonce::from_slice(XNonce::from_slice(&nonce_bytes)), XNonce::from_slice(XNonce::from_slice(&nonce_bytes)),
key, key,
@ -138,12 +138,12 @@ async fn read_file(
} }
} }
struct EncryptedDiskReader<R> { struct EncryptedReader<R> {
file: Pin<Box<R>>, file: Pin<Box<R>>,
keystream: XChaCha20, keystream: XChaCha20,
} }
impl<R> EncryptedDiskReader<R> { impl<R> EncryptedReader<R> {
fn new(file: R, nonce: &XNonce, key: &Key) -> Self { fn new(file: R, nonce: &XNonce, key: &Key) -> Self {
Self { Self {
file: Box::pin(file), file: Box::pin(file),
@ -165,7 +165,7 @@ impl<R: AsyncBufRead + Send> MetadataFetch for R {
} }
} }
impl<R: AsyncRead> AsyncRead for EncryptedDiskReader<R> { impl<R: AsyncRead> AsyncRead for EncryptedReader<R> {
fn poll_read( fn poll_read(
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,
cx: &mut Context<'_>, cx: &mut Context<'_>,