Skip to main content

ArrayShardedReadableExt

Trait ArrayShardedReadableExt 

Source
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>;
}
Available on crate feature 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ยง

Source

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.

Source

fn retrieve_encoded_subchunk( &self, cache: &ArrayShardedReadableExtCache, subchunk_indices: &[u64], ) -> Result<Option<Vec<u8>>, ArrayError>

Retrieve the encoded bytes of a subchunk.

See Array::retrieve_encoded_chunk.

Source

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.

See Array::retrieve_chunk_opt.

Source

fn 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

Read and decode the subchunk at subchunk_indices into a vector of its elements.

See Array::retrieve_chunk_elements_opt.

Source

fn 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.

Read and decode the subchunk at subchunk_indices into an ndarray::ArrayD.

See Array::retrieve_chunk_ndarray_opt.

Source

fn retrieve_subchunks_opt<T: FromArrayBytes>( &self, cache: &ArrayShardedReadableExtCache, subchunks: &dyn ArraySubsetTraits, options: &CodecOptions, ) -> Result<T, ArrayError>

Read and decode the subchunks at subchunks.

See Array::retrieve_chunks_opt.

Source

fn 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

Read and decode the subchunks at subchunks into a vector of their elements.

See Array::retrieve_chunks_elements_opt.

Source

fn 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.

Read and decode the subchunks at subchunks into an ndarray::ArrayD.

See Array::retrieve_chunks_ndarray_opt.

Source

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.

See Array::retrieve_array_subset_opt.

Source

fn 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

Read and decode the array_subset of array into a vector of its elements.

See Array::retrieve_array_subset_elements_opt.

Source

fn 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.

Read and decode the array_subset of array into an ndarray::ArrayD.

See Array::retrieve_array_subset_ndarray_opt.

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.

Implementorsยง

Sourceยง

impl<TStorage: ?Sized + ReadableStorageTraits + 'static> ArrayShardedReadableExt<TStorage> for Array<TStorage>