Skip to content

Aggresive caching in PrefetchReader #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "Low-level asynchronous TIFF reader."
readme = "README.md"

[dependencies]
async-mutex = { version = "1.4.0", optional = true }
byteorder = "1"
bytes = "1.7.0"
flate2 = "1.0.20"
Expand All @@ -31,13 +32,15 @@ tokio = { version = "1.9", features = [
"macros",
"fs",
"rt-multi-thread",
# "rt",
"io-util",
] }

[features]
default = ["object_store", "reqwest"]
default = ["object_store", "reqwest", "async_mutex"]
tokio = ["dep:tokio"]
reqwest = ["dep:reqwest"]
object_store = ["dep:object_store"]
async_mutex = ["dep:async-mutex"]

[package.metadata.cargo-all-features]
8 changes: 6 additions & 2 deletions python/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,15 @@ struct ObspecReader {
}

impl AsyncFileReader for ObspecReader {
fn get_bytes(&self, range: Range<u64>) -> BoxFuture<'_, AsyncTiffResult<Bytes>> {
fn get_metadata_bytes(&self, range: Range<u64>) -> BoxFuture<'_, AsyncTiffResult<Bytes>> {
self.backend.get_range_wrapper(&self.path, range).boxed()
}

fn get_byte_ranges(
fn get_image_bytes(&self, range: Range<u64>) -> BoxFuture<'_, AsyncTiffResult<Bytes>> {
self.backend.get_range_wrapper(&self.path, range).boxed()
}

fn get_image_byte_ranges(
&self,
ranges: Vec<Range<u64>>,
) -> BoxFuture<'_, AsyncTiffResult<Vec<Bytes>>> {
Expand Down
Loading