pub struct ReadOptions {Show 13 fields
pub range: BytesRange,
pub version: Option<String>,
pub if_match: Option<String>,
pub if_none_match: Option<String>,
pub if_modified_since: Option<Timestamp>,
pub if_unmodified_since: Option<Timestamp>,
pub content_length_hint: Option<u64>,
pub concurrent: usize,
pub chunk: Option<usize>,
pub gap: Option<usize>,
pub override_content_type: Option<String>,
pub override_cache_control: Option<String>,
pub override_content_disposition: Option<String>,
}Expand description
Options for read operations.
Fields§
§range: BytesRangeSet range for this operation.
If we have a file with size n.
..means read bytes in range[0, n)of file.0..1024and..1024means read bytes in range[0, 1024)of file1024..means read bytes in range[1024, n)of fileBytesRange::suffix(1024)means read the lastmin(1024, n)bytes of file
The type implements From<RangeBounds<u64>>, so users can use (1024..).into() instead.
version: Option<String>Set version for this operation.
This option can be used to retrieve the data of a specified version of the given path.
If the version doesn’t exist, an error with kind crate::ErrorKind::NotFound will be returned.
if_match: Option<String>Set if_match for this operation.
This option can be used to check if the file’s ETag matches the given ETag.
If file exists and it’s etag doesn’t match, an error with kind crate::ErrorKind::ConditionNotMatch
will be returned.
if_none_match: Option<String>Set if_none_match for this operation.
This option can be used to check if the file’s ETag doesn’t match the given ETag.
If file exists and it’s etag match, an error with kind crate::ErrorKind::ConditionNotMatch
will be returned.
if_modified_since: Option<Timestamp>Set if_modified_since for this operation.
This option can be used to check if the file has been modified since the given timestamp.
If file exists and it hasn’t been modified since the specified time, an error with kind
crate::ErrorKind::ConditionNotMatch will be returned.
if_unmodified_since: Option<Timestamp>Set if_unmodified_since for this operation.
This feature can be used to check if the file hasn’t been modified since the given timestamp.
If file exists and it has been modified since the specified time, an error with kind
crate::ErrorKind::ConditionNotMatch will be returned.
content_length_hint: Option<u64>Known content length of the object.
This is an execution hint that allows OpenDAL to avoid extra metadata requests while planning reads. It must not be used as an object identity or consistency condition.
concurrent: usizeSet concurrent for the operation.
OpenDAL by default to read file without concurrent. This is not efficient for cases when users
read large chunks of data. By setting concurrent, opendal will reading files concurrently
on support storage services.
By setting concurrent, opendal will fetch chunks concurrently with
the give chunk size.
Refer to the performance guide for more details.
chunk: Option<usize>Set chunk for the operation.
OpenDAL will use services’ preferred chunk size by default. Users can set chunk based on their own needs.
Refer to the performance guide for more details.
gap: Option<usize>Controls the optimization strategy for range reads in crate::Reader::fetch.
When performing range reads, if the gap between two requested ranges is less than or
equal to the configured gap size, OpenDAL will merge these ranges into a single read request
and discard the unrequested data in between. This helps reduce the number of API calls
to remote storage services.
Set to 0 to disable merging ranges separated by a gap. Overlapping or adjacent ranges
are still merged.
This optimization is particularly useful when performing multiple small range reads that are close to each other, as it reduces the overhead of multiple network requests at the cost of transferring some additional data.
Refer to the performance guide for more details.
override_content_type: Option<String>Specify the content-type header that should be sent back by the operation.
This option is only meaningful when used along with presign.
override_cache_control: Option<String>Specify the cache-control header that should be sent back by the operation.
This option is only meaningful when used along with presign.
override_content_disposition: Option<String>Specify the content-disposition header that should be sent back by the operation.
This option is only meaningful when used along with presign.
Trait Implementations§
Source§impl Clone for ReadOptions
impl Clone for ReadOptions
Source§fn clone(&self) -> ReadOptions
fn clone(&self) -> ReadOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more