Skip to content

Commit e897ba7

Browse files
committed
Update docs
1 parent 6d7cb00 commit e897ba7

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/metadata/mod.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
//!
1212
//! use object_store::local::LocalFileSystem;
1313
//!
14-
//! use async_tiff::metadata::{PrefetchBuffer, TiffMetadataReader};
14+
//! use async_tiff::metadata::TiffMetadataReader;
15+
//! use async_tiff::metadata::cache::ReadaheadMetadataCache;
1516
//! use async_tiff::reader::ObjectReader;
1617
//!
1718
//! // Create new Arc<dyn ObjectStore>
@@ -23,24 +24,22 @@
2324
//! "tests/image_tiff/images/tiled-jpeg-rgb-u8.tif".into(),
2425
//! );
2526
//!
26-
//! // Use PrefetchBuffer to ensure that a given number of bytes at the start of the
27-
//! // file are prefetched.
27+
//! // Use ReadaheadMetadataCache to ensure that a given number of bytes at the start of the
28+
//! // file are prefetched, and to ensure that any additional fetches are made in larger chunks.
2829
//! //
29-
//! // This or a similar caching layer should **always** be used and ensures that the
30-
//! // underlying read calls that the TiffMetadataReader makes don't translate to actual
31-
//! // network fetches.
32-
//! let prefetch_reader = PrefetchBuffer::new(reader.clone(), 32 * 1024)
33-
//! .await
34-
//! .unwrap();
30+
//! // The `ReadaheadMetadataCache` or a similar caching layer should **always** be used to ensure
31+
//! // that the underlying small read calls that the TiffMetadataReader makes don't translate to
32+
//! // individual tiny network fetches.
33+
//! let cached_reader = ReadaheadMetadataCache::new(reader.clone());
3534
//!
3635
//! // Create a TiffMetadataReader wrapping some MetadataFetch
37-
//! let mut metadata_reader = TiffMetadataReader::try_open(&prefetch_reader)
36+
//! let mut metadata_reader = TiffMetadataReader::try_open(&cached_reader)
3837
//! .await
3938
//! .unwrap();
4039
//!
4140
//! // Read all IFDs out of the source.
4241
//! let ifds = metadata_reader
43-
//! .read_all_ifds(&prefetch_reader)
42+
//! .read_all_ifds(&cached_reader)
4443
//! .await
4544
//! .unwrap();
4645
//! # })
@@ -54,9 +53,9 @@
5453
//! [`MetadataFetch`] implementation.
5554
//!
5655
//! Thus, it is **imperative to always supply some sort of caching, prefetching, or buffering**
57-
//! middleware when reading metadata. [`PrefetchBuffer`] is an example of this, which
58-
//! fetches the first `N` bytes out of a file.
59-
//!
56+
//! middleware when reading metadata. [`ReadaheadMetadataCache`] is an example of this, which
57+
//! fetches the first `N` bytes out of a file, and then multiplies the size of any subsequent
58+
//! fetches by a given `multiplier`.
6059
6160
pub mod cache;
6261
mod fetch;

0 commit comments

Comments
 (0)