Trait ArrayShardedReadableExt

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

Source

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.

Source

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.

See Array::retrieve_encoded_chunk.

Source

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.

See Array::retrieve_chunk_opt.

Source

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.

See Array::retrieve_chunk_elements_opt.

Source

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

Read and decode the chunk at chunk_indices into an ndarray::ArrayD.

See Array::retrieve_chunk_ndarray_opt.

Source

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.

See Array::retrieve_chunks_opt.

Source

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.

See Array::retrieve_chunks_elements_opt.

Source

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

Read and decode the inner chunks at inner_chunks into an ndarray::ArrayD.

See Array::retrieve_chunks_ndarray_opt.

Source

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.

See Array::retrieve_array_subset_opt.

Source

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.

See Array::retrieve_array_subset_elements_opt.

Source

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

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>