pub trait ArrayShardedReadableExt<TStorage: ?Sized + ReadableStorageTraits + 'static>: Sealed {
// Required methods
fn inner_chunk_byte_range(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
) -> Result<Option<ByteRange>, ArrayError>;
fn retrieve_encoded_inner_chunk(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
) -> Result<Option<Vec<u8>>, ArrayError>;
fn retrieve_inner_chunk_opt(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
options: &CodecOptions,
) -> Result<ArrayBytes<'_>, ArrayError>;
fn retrieve_inner_chunk_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>;
fn retrieve_inner_chunk_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>;
fn retrieve_inner_chunks_opt(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunks: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayBytes<'_>, ArrayError>;
fn retrieve_inner_chunks_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunks: &ArraySubset,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>;
fn retrieve_inner_chunks_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunks: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>;
fn retrieve_array_subset_sharded_opt(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayBytes<'_>, ArrayError>;
fn retrieve_array_subset_elements_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &ArraySubset,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>;
fn retrieve_array_subset_ndarray_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>;
}
sharding
only.Expand description
An Array
extension trait to efficiently read data (e.g. inner chunks) from arrays using the sharding_indexed
codec.
Sharding indexes are cached in a ArrayShardedReadableExtCache
enabling faster retrieval.
Required Methods§
Sourcefn inner_chunk_byte_range(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
) -> Result<Option<ByteRange>, ArrayError>
fn inner_chunk_byte_range( &self, cache: &ArrayShardedReadableExtCache, inner_chunk_indices: &[u64], ) -> Result<Option<ByteRange>, ArrayError>
Retrieve the byte range of an encoded inner chunk.
§Errors
Returns an ArrayError
on failure, such as if decoding the shard index fails.
Sourcefn retrieve_encoded_inner_chunk(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
) -> Result<Option<Vec<u8>>, ArrayError>
fn retrieve_encoded_inner_chunk( &self, cache: &ArrayShardedReadableExtCache, inner_chunk_indices: &[u64], ) -> Result<Option<Vec<u8>>, ArrayError>
Retrieve the encoded bytes of an inner chunk.
Sourcefn retrieve_inner_chunk_opt(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
options: &CodecOptions,
) -> Result<ArrayBytes<'_>, ArrayError>
fn retrieve_inner_chunk_opt( &self, cache: &ArrayShardedReadableExtCache, inner_chunk_indices: &[u64], options: &CodecOptions, ) -> Result<ArrayBytes<'_>, ArrayError>
Read and decode the inner chunk at chunk_indices
into its bytes.
Sourcefn retrieve_inner_chunk_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>
fn retrieve_inner_chunk_elements_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, inner_chunk_indices: &[u64], options: &CodecOptions, ) -> Result<Vec<T>, ArrayError>
Read and decode the inner chunk at chunk_indices
into a vector of its elements.
Sourcefn retrieve_inner_chunk_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunk_indices: &[u64],
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>
Available on crate feature ndarray
only.
fn retrieve_inner_chunk_ndarray_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, inner_chunk_indices: &[u64], options: &CodecOptions, ) -> Result<ArrayD<T>, ArrayError>
ndarray
only.Read and decode the chunk at chunk_indices
into an ndarray::ArrayD
.
Sourcefn retrieve_inner_chunks_opt(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunks: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayBytes<'_>, ArrayError>
fn retrieve_inner_chunks_opt( &self, cache: &ArrayShardedReadableExtCache, inner_chunks: &ArraySubset, options: &CodecOptions, ) -> Result<ArrayBytes<'_>, ArrayError>
Read and decode the chunks at chunks
into their bytes.
Sourcefn retrieve_inner_chunks_elements_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunks: &ArraySubset,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>
fn retrieve_inner_chunks_elements_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, inner_chunks: &ArraySubset, options: &CodecOptions, ) -> Result<Vec<T>, ArrayError>
Read and decode the inner chunks at inner_chunks
into a vector of their elements.
Sourcefn retrieve_inner_chunks_ndarray_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
inner_chunks: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>
Available on crate feature ndarray
only.
fn retrieve_inner_chunks_ndarray_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, inner_chunks: &ArraySubset, options: &CodecOptions, ) -> Result<ArrayD<T>, ArrayError>
ndarray
only.Read and decode the inner chunks at inner_chunks
into an ndarray::ArrayD
.
Sourcefn retrieve_array_subset_sharded_opt(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayBytes<'_>, ArrayError>
fn retrieve_array_subset_sharded_opt( &self, cache: &ArrayShardedReadableExtCache, array_subset: &ArraySubset, options: &CodecOptions, ) -> Result<ArrayBytes<'_>, ArrayError>
Read and decode the array_subset
of array into its bytes.
Sourcefn retrieve_array_subset_elements_sharded_opt<T: ElementOwned>(
&self,
cache: &ArrayShardedReadableExtCache,
array_subset: &ArraySubset,
options: &CodecOptions,
) -> Result<Vec<T>, ArrayError>
fn retrieve_array_subset_elements_sharded_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, array_subset: &ArraySubset, options: &CodecOptions, ) -> Result<Vec<T>, ArrayError>
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: &ArraySubset,
options: &CodecOptions,
) -> Result<ArrayD<T>, ArrayError>
Available on crate feature ndarray
only.
fn retrieve_array_subset_ndarray_sharded_opt<T: ElementOwned>( &self, cache: &ArrayShardedReadableExtCache, array_subset: &ArraySubset, options: &CodecOptions, ) -> Result<ArrayD<T>, ArrayError>
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.