Skip to content

Commit

Permalink
2x speed on GET for filesystem back-end (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdejager committed Aug 21, 2020
1 parent 2f36e93 commit 74fd8e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/storage/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Filesystem {

#[async_trait]
impl<U: Send + Sync + Debug> StorageBackend<U> for Filesystem {
type File = tokio::fs::File;
type File = tokio::io::BufReader<tokio::fs::File>;
type Metadata = std::fs::Metadata;

fn supported_features(&self) -> u32 {
Expand Down Expand Up @@ -117,7 +117,7 @@ impl<U: Send + Sync + Debug> StorageBackend<U> for Filesystem {
if start_pos > 0 {
file.seek(std::io::SeekFrom::Start(start_pos)).await?;
}
Ok(file)
Ok(tokio::io::BufReader::new(file))
}
.map_err(|error: std::io::Error| match error.kind() {
std::io::ErrorKind::NotFound => Error::from(ErrorKind::PermanentFileNotAvailable),
Expand Down

0 comments on commit 74fd8e2

Please sign in to comment.