server/compression: Don't wrap HashReader output stream in BufReader
Now it implements AsyncBufRead if the inner stream also implements it.
This commit is contained in:
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use digest::Output as DigestOutput;
|
||||
use sha2::{Digest, Sha256};
|
||||
use tokio::io::{AsyncBufRead, AsyncRead, BufReader};
|
||||
use tokio::io::{AsyncBufRead, AsyncRead};
|
||||
use tokio::sync::OnceCell;
|
||||
|
||||
use attic::io::HashReader;
|
||||
@@ -38,7 +38,7 @@ pub struct CompressionStream {
|
||||
|
||||
impl CompressionStream {
|
||||
/// Creates a new compression stream.
|
||||
pub fn new<R>(stream: R, compressor: CompressorFn<BufReader<HashReader<R, Sha256>>>) -> Self
|
||||
pub fn new<R>(stream: R, compressor: CompressorFn<HashReader<R, Sha256>>) -> Self
|
||||
where
|
||||
R: AsyncBufRead + Unpin + Send + 'static,
|
||||
{
|
||||
@@ -46,7 +46,7 @@ impl CompressionStream {
|
||||
let (stream, nar_compute) = HashReader::new(stream, Sha256::new());
|
||||
|
||||
// compress NAR
|
||||
let stream = compressor(BufReader::new(stream));
|
||||
let stream = compressor(stream);
|
||||
|
||||
// compute file hash and size
|
||||
let (stream, file_compute) = HashReader::new(stream, Sha256::new());
|
||||
|
||||
Reference in New Issue
Block a user