pub struct ReadOptions {
pub range: BytesRange,
pub version: Option<String>,
pub if_match: Option<String>,
pub if_none_match: Option<String>,
pub if_modified_since: Option<DateTime<Utc>>,
pub if_unmodified_since: Option<DateTime<Utc>>,
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 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 [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 [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 [ErrorKind::ConditionNotMatch]
will be returned.
if_modified_since: Option<DateTime<Utc>>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
[ErrorKind::ConditionNotMatch] will be returned.
if_unmodified_since: Option<DateTime<Utc>>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
[ErrorKind::ConditionNotMatch] will be returned.
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 [crate::docs::performance] 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 [crate::docs::performance] for more details.
gap: Option<usize>Controls the optimization strategy for range reads in [Reader::fetch].
When performing range reads, if the gap between two requested ranges is smaller than
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.
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 [crate::docs::performance] 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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReadOptions
impl Debug for ReadOptions
Source§impl Default for ReadOptions
impl Default for ReadOptions
Source§fn default() -> ReadOptions
fn default() -> ReadOptions
Source§impl From<ReadOptions> for (OpRead, OpReader)
impl From<ReadOptions> for (OpRead, OpReader)
Source§fn from(value: ReadOptions) -> Self
fn from(value: ReadOptions) -> Self
Source§impl PartialEq for ReadOptions
impl PartialEq for ReadOptions
impl Eq for ReadOptions
impl StructuralPartialEq for ReadOptions
Auto Trait Implementations§
impl Freeze for ReadOptions
impl RefUnwindSafe for ReadOptions
impl Send for ReadOptions
impl Sync for ReadOptions
impl Unpin for ReadOptions
impl UnwindSafe for ReadOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.