Skip to main content

ShardingCodec

Struct ShardingCodec 

Source
pub struct ShardingCodec { /* private fields */ }
Available on crate feature sharding only.
Expand description

A sharding codec implementation.

Implementations§

Source§

impl ShardingCodec

Source

pub fn new( subchunk_shape: ChunkShape, inner_codecs: Arc<CodecChain>, index_codecs: Arc<CodecChain>, index_location: ShardingIndexLocation, ) -> Self

Create a new sharding codec.

Source

pub fn new_with_configuration( configuration: &ShardingCodecConfiguration, ) -> Result<Self, PluginCreateError>

Create a new sharding codec from configuration.

§Errors

Returns PluginCreateError if there is a configuration issue.

Source

pub fn with_options(self, options: ShardingCodecOptions) -> Self

Return a version of this codec with the provided ShardingCodecOptions.

Source

pub fn with_subchunk_write_order(self, order: SubchunkWriteOrder) -> Self

Return a version of this codec with the provided SubchunkWriteOrder.

Source§

impl ShardingCodec

Source

pub fn decode_index( &self, encoded_shard: &[u8], chunks_per_shard: &[NonZeroU64], options: &CodecOptions, ) -> Result<Vec<u64>, CodecError>

Decode the shard index inside the given encoded shard.

§Errors

Returns CodecError if the decoded shard index is not valid.

§Panics

Panics if the encoded index size or the encoded shard minux its index length exceeds usize::MAX.

Trait Implementations§

Source§

impl ArrayCodecTraits for ShardingCodec

Source§

fn recommended_concurrency( &self, shape: &[NonZeroU64], _data_type: &DataType, ) -> Result<RecommendedConcurrency, CodecError>

Return the recommended concurrency for the requested decoded representation. Read more
Source§

fn partial_decode_granularity(&self, _shape: &[NonZeroU64]) -> ChunkShape

Return the partial decode granularity. Read more
Source§

impl ArrayToBytesCodecTraits for ShardingCodec

Source§

fn into_dyn(self: Arc<Self>) -> Arc<dyn ArrayToBytesCodecTraits> ⓘ

Return a dynamic version of the codec.
Source§

fn with_codec_specific_options( self: Arc<Self>, opts: &CodecSpecificOptions, ) -> Arc<dyn ArrayToBytesCodecTraits> ⓘ

Return a version of this codec reconfigured with the provided codec-specific options. Read more
Source§

fn encode<'a>( &self, bytes: ArrayBytes<'a>, shape: &[NonZeroU64], data_type: &DataType, fill_value: &FillValue, options: &CodecOptions, ) -> Result<ArrayBytesRaw<'a>, CodecError>

Encode a chunk. Read more
Source§

fn decode<'a>( &self, encoded_shard: ArrayBytesRaw<'a>, shape: &[NonZeroU64], data_type: &DataType, fill_value: &FillValue, options: &CodecOptions, ) -> Result<ArrayBytes<'a>, CodecError>

Decode a chunk. Read more
Source§

fn compact<'a>( &self, bytes: ArrayBytesRaw<'a>, shape: &[NonZeroU64], _data_type: &DataType, _fill_value: &FillValue, options: &CodecOptions, ) -> Result<Option<ArrayBytesRaw<'a>>, CodecError>

Compact a chunk. Read more
Source§

fn decode_into( &self, encoded_shard: ArrayBytesRaw<'_>, shape: &[NonZeroU64], data_type: &DataType, fill_value: &FillValue, output_target: ArrayBytesDecodeIntoTarget<'_>, options: &CodecOptions, ) -> Result<(), CodecError>

Decode into a subset of a preallocated output. Read more
Source§

fn partial_decoder( self: Arc<Self>, input_handle: Arc<dyn BytesPartialDecoderTraits>, shape: &[NonZeroU64], data_type: &DataType, fill_value: &FillValue, options: &CodecOptions, ) -> Result<Arc<dyn ArrayPartialDecoderTraits>, CodecError>

Initialise a partial decoder. Read more
Source§

fn async_partial_decoder<'life0, 'life1, 'life2, 'life3, 'async_trait>( self: Arc<Self>, input_handle: Arc<dyn AsyncBytesPartialDecoderTraits>, shape: &'life0 [NonZeroU64], data_type: &'life1 DataType, fill_value: &'life2 FillValue, options: &'life3 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn AsyncArrayPartialDecoderTraits>, CodecError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Available on crate feature async only.
Initialise an asynchronous partial decoder. Read more
Source§

fn partial_encoder( self: Arc<Self>, input_output_handle: Arc<dyn BytesPartialEncoderTraits>, shape: &[NonZeroU64], data_type: &DataType, fill_value: &FillValue, options: &CodecOptions, ) -> Result<Arc<dyn ArrayPartialEncoderTraits>, CodecError>

Initialise a partial encoder. Read more
Source§

fn encoded_representation( &self, shape: &[NonZeroU64], data_type: &DataType, fill_value: &FillValue, ) -> Result<BytesRepresentation, CodecError>

Returns the size of the encoded representation given a size of the decoded representation. Read more
Source§

fn async_partial_encoder<'life0, 'life1, 'life2, 'life3, 'async_trait>( self: Arc<Self>, input_output_handle: Arc<dyn AsyncBytesPartialEncoderTraits>, shape: &'life0 [NonZero<u64>], data_type: &'life1 DataType, fill_value: &'life2 FillValue, options: &'life3 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn AsyncArrayPartialEncoderTraits>, CodecError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + Send + 'async_trait,

Available on crate feature async only.
Initialise an asynchronous partial encoder. Read more
Source§

impl Clone for ShardingCodec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CodecTraits for ShardingCodec

Source§

fn as_any(&self) -> &dyn Any

Returns this codec as Any.
Source§

fn configuration( &self, _version: ZarrVersion, options: &CodecMetadataOptions, ) -> Option<Configuration>

Create the codec configuration. Read more
Source§

fn partial_decoder_capability(&self) -> PartialDecoderCapability

Returns the partial decoder capability of this codec.
Source§

fn partial_encoder_capability(&self) -> PartialEncoderCapability

Returns the partial encoder capability of this codec.
Source§

fn configuration_v3( &self, options: &CodecMetadataOptions, ) -> Option<Configuration>

Create the Zarr V3 codec configuration.
Source§

fn configuration_v2( &self, options: &CodecMetadataOptions, ) -> Option<Configuration>

Create the Zarr V2 codec configuration.
Source§

impl CodecTraitsV3 for ShardingCodec

Source§

fn create(metadata: &MetadataV3) -> Result<Codec, PluginCreateError>

Create a codec from Zarr V3 metadata. Read more
Source§

impl Debug for ShardingCodec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExtensionAliases<ZarrVersion2> for ShardingCodec

Source§

fn aliases() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the aliases configuration for this version.
Source§

fn aliases_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the aliases configuration for this version.
Source§

fn matches_name(_name: &str) -> bool

Check if the given name matches this extension’s identifier or any of its aliases for the given Zarr version. Read more
Source§

impl ExtensionAliases<ZarrVersion3> for ShardingCodec

Source§

fn aliases() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the aliases configuration for this version.
Source§

fn aliases_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the aliases configuration for this version.
Source§

fn matches_name(name: &str) -> bool

Check if the given name matches this extension’s identifier or any of its aliases for the given Zarr version. Read more
Source§

impl ExtensionNameStatic for ShardingCodec

Source§

const DEFAULT_NAME_FN: fn(ZarrVersion) -> Option<Cow<'static, str>>

Function pointer to get the default name for a given Zarr version. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ExtensionAliasesV2 for T

Source§

fn aliases_v2() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the V2 aliases configuration.
Source§

fn aliases_v2_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the V2 aliases configuration.
Source§

fn matches_name_v2(name: &str) -> bool

Check if the given name matches this extension for Zarr V2.
Source§

impl<T> ExtensionAliasesV3 for T

Source§

fn aliases_v3() -> RwLockReadGuard<'static, ExtensionAliasesConfig>

Get a read lock on the V3 aliases configuration.
Source§

fn aliases_v3_mut() -> RwLockWriteGuard<'static, ExtensionAliasesConfig>

Get a write lock on the V3 aliases configuration.
Source§

fn matches_name_v3(name: &str) -> bool

Check if the given name matches this extension for Zarr V3.
Source§

impl<T> ExtensionName for T

Source§

fn name(&self, version: ZarrVersion) -> Option<Cow<'static, str>>

Get the name for this extension instance for the given Zarr version. Read more
Source§

fn name_v3(&self) -> Option<Cow<'static, str>>

Get the name for this extension instance for Zarr V3. Read more
Source§

fn name_v2(&self) -> Option<Cow<'static, str>>

Get the name for this extension instance for Zarr V2. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.