pub trait ArrayShardedReadableExt<TStorage: ?Sized + ReadableStorageTraits + 'static>: Sealed {
// Required methods
fn subchunk_byte_range(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
) -> Result<Option<ByteRange>, ArrayError>;
fn retrieve_encoded_subchunk(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
) -> Result<Option<Vec<u8>>, ArrayError>;
fn retrieve_subchunk_opt<T: FromArrayBytes>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
options: &CodecOptions,
) -> Result<T, ArrayError>;
fn retrieve_subchunk_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>;
fn retrieve_subchunk_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>;
fn retrieve_subchunks_opt<T: FromArrayBytes>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunks: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<T, ArrayError>;
fn retrieve_subchunks_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunks: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>;
fn retrieve_subchunks_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunks: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>;
fn retrieve_array_subset_sharded_opt<T: FromArrayBytes>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<T, ArrayError>;
fn retrieve_array_subset_elements_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>;
fn retrieve_array_subset_ndarray_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>;
}sharding only.Expand description
An Array extension trait to efficiently read data (e.g. subchunks) from arrays using the sharding_indexed codec.
Sharding indexes are cached in a ArrayShardedReadableExtCache enabling faster retrieval.
Required Methodsยง
Sourcefn subchunk_byte_range(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
) -> Result<Option<ByteRange>, ArrayError>
fn subchunk_byte_range( &self, cache: &ArrayShardedReadableExtCache, subchunk_indices: &[u64], ) -> Result<Option<ByteRange>, ArrayError>
Retrieve the byte range of an encoded subchunk.
ยงErrors
Returns an ArrayError on failure, such as if decoding the shard index fails.
Sourcefn retrieve_encoded_subchunk(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
) -> Result<Option<Vec<u8>>, ArrayError>
fn retrieve_encoded_subchunk( &self, cache: &ArrayShardedReadableExtCache, subchunk_indices: &[u64], ) -> Result<Option<Vec<u8>>, ArrayError>
Retrieve the encoded bytes of a subchunk.
Sourcefn retrieve_subchunk_opt<T: FromArrayBytes>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
options: &CodecOptions,
) -> Result<T, ArrayError>
fn retrieve_subchunk_opt<T: FromArrayBytes>( &self, cache: &ArrayShardedReadableExtCache, subchunk_indices: &[u64], options: &CodecOptions, ) -> Result<T, ArrayError>
Read and decode the subchunk at subchunk_indices into its bytes.
Sourcefn retrieve_subchunk_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>
๐Deprecated since 0.23.0: Use retrieve_subchunk_opt::<Vec<T>>() instead
fn retrieve_subchunk_elements_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, subchunk_indices: &[u64], options: &CodecOptions, ) -> Result<Vec<T>, ArrayError>
Use retrieve_subchunk_opt::<Vec<T>>() instead
Read and decode the subchunk at subchunk_indices into a vector of its elements.
Sourcefn retrieve_subchunk_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunk_indices: &[u64],
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>
๐Deprecated since 0.23.0: Use retrieve_subchunk_opt::<ndarray::ArrayD<T>>() instead
Available on crate feature ndarray only.
fn retrieve_subchunk_ndarray_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, subchunk_indices: &[u64], options: &CodecOptions, ) -> Result<ArrayD<T>, ArrayError>
Use retrieve_subchunk_opt::<ndarray::ArrayD<T>>() instead
ndarray only.Read and decode the subchunk at subchunk_indices into an ndarray::ArrayD.
Sourcefn retrieve_subchunks_opt<T: FromArrayBytes>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunks: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<T, ArrayError>
fn retrieve_subchunks_opt<T: FromArrayBytes>( &self, cache: &ArrayShardedReadableExtCache, subchunks: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<T, ArrayError>
Read and decode the subchunks at subchunks.
Sourcefn retrieve_subchunks_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunks: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>
๐Deprecated since 0.23.0: Use retrieve_subchunks_opt::<Vec<T>>() instead
fn retrieve_subchunks_elements_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, subchunks: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<Vec<T>, ArrayError>
Use retrieve_subchunks_opt::<Vec<T>>() instead
Read and decode the subchunks at subchunks into a vector of their elements.
Sourcefn retrieve_subchunks_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
subchunks: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>
๐Deprecated since 0.23.0: Use retrieve_subchunks_opt::<ndarray::ArrayD<T>>() instead
Available on crate feature ndarray only.
fn retrieve_subchunks_ndarray_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, subchunks: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<ArrayD<T>, ArrayError>
Use retrieve_subchunks_opt::<ndarray::ArrayD<T>>() instead
ndarray only.Read and decode the subchunks at subchunks into an ndarray::ArrayD.
Sourcefn retrieve_array_subset_sharded_opt<T: FromArrayBytes>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<T, ArrayError>
fn retrieve_array_subset_sharded_opt<T: FromArrayBytes>( &self, cache: &ArrayShardedReadableExtCache, array_subset: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<T, ArrayError>
Read and decode the array_subset of array.
Sourcefn retrieve_array_subset_elements_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>
๐Deprecated since 0.23.0: Use retrieve_array_subset_sharded_opt::<Vec<T>>() instead
fn retrieve_array_subset_elements_sharded_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, array_subset: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<Vec<T>, ArrayError>
Use retrieve_array_subset_sharded_opt::<Vec<T>>() instead
Read and decode the array_subset of array into a vector of its elements.
Sourcefn retrieve_array_subset_ndarray_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &dyn ArraySubsetTraits,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>
๐Deprecated since 0.23.0: Use retrieve_array_subset_sharded_opt::<ndarray::ArrayD<T>>() instead
Available on crate feature ndarray only.
fn retrieve_array_subset_ndarray_sharded_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, array_subset: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<ArrayD<T>, ArrayError>
Use retrieve_array_subset_sharded_opt::<ndarray::ArrayD<T>>() instead
ndarray only.Read and decode the array_subset of array into an ndarray::ArrayD.
Dyn Compatibilityยง
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.