Skip to content

Commit 709b14e

Browse files
committed
Allow getting the hash for a reader, and make the constructor pub(super).
1 parent b2658b6 commit 709b14e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/api/blobs/reader.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ use std::{
66

77
use n0_future::StreamExt;
88

9-
use crate::api::{
10-
blobs::{Blobs, ReaderOptions},
11-
proto::ExportRangesItem,
9+
use crate::{
10+
api::{
11+
blobs::{Blobs, ReaderOptions},
12+
proto::ExportRangesItem,
13+
},
14+
Hash,
1215
};
1316

1417
/// A reader for blobs that implements `AsyncRead` and `AsyncSeek`.
@@ -37,13 +40,17 @@ enum ReaderState {
3740
}
3841

3942
impl BlobReader {
40-
pub fn new(blobs: Blobs, options: ReaderOptions) -> Self {
43+
pub(super) fn new(blobs: Blobs, options: ReaderOptions) -> Self {
4144
Self {
4245
blobs,
4346
options,
4447
state: ReaderState::Idle { position: 0 },
4548
}
4649
}
50+
51+
pub fn hash(&self) -> &Hash {
52+
&self.options.hash
53+
}
4754
}
4855

4956
impl tokio::io::AsyncRead for BlobReader {

0 commit comments

Comments
 (0)