Enum object_store::GetResult
source · pub enum GetResult {
File(File, PathBuf),
Stream(BoxStream<'static, Result<Bytes>>),
}
Expand description
Result for a get request
This special cases the case of a local file, as some systems may be able to optimise the case of a file already present on local disk
Variants§
File(File, PathBuf)
A file and its path on the local filesystem
Stream(BoxStream<'static, Result<Bytes>>)
An asynchronous stream
Implementations§
source§impl GetResult
impl GetResult
sourcepub fn into_stream(self) -> BoxStream<'static, Result<Bytes>>
pub fn into_stream(self) -> BoxStream<'static, Result<Bytes>>
Converts this into a byte stream
If the result is Self::File
will perform chunked reads of the file, otherwise
will return the Self::Stream
.
Tokio Compatibility
Tokio discourages performing blocking IO on a tokio worker thread, however,
no major operating systems have stable async file APIs. Therefore if called from
a tokio context, this will use tokio::runtime::Handle::spawn_blocking
to dispatch
IO to a blocking thread pool, much like tokio::fs
does under-the-hood.
If not called from a tokio context, this will perform IO on the current thread with no additional complexity or overheads