Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

Global configuration options for the zarrs crate.

Serialisation/deserialisation of the config does NOT currently include the extension alias maps. This will be addressed in a future breaking release.

Retrieve the global Config with global_config and modify it with global_config_mut.

§Codec / Chunk Options

§Validate Checksums

default: true

CodecOptions::validate_checksums() defaults to Config::validate_checksums().

If validate checksums is enabled, checksum codecs (e.g. crc32c, fletcher32) will validate that encoded data matches stored checksums, otherwise validation is skipped. Note that regardless of this configuration option, checksum codecs may skip validation when partial decoding.

§Store Empty Chunks

default: false

CodecOptions::store_empty_chunks() defaults to Config::store_empty_chunks().

If false, empty chunks (where all elements match the fill value) will not be stored. This incurs a computational overhead as each element must be tested for equality to the fill value before a chunk is encoded. If true, the aforementioned test is skipped and empty chunks will be stored. Note that empty chunks must still be stored explicitly (e.g. with Array::store_chunk).

§Codec Concurrent Target

default: std::thread::available_parallelism()

CodecOptions::concurrent_target() defaults to Config::codec_concurrent_target().

The default number of concurrent operations to target for codec encoding and decoding. Limiting concurrent operations is needed to reduce memory usage and improve performance. Concurrency is unconstrained if the concurrent target if set to zero.

Note that the default codec concurrent target can be overridden for any encode/decode operation. This is performed automatically for many array operations (see the chunk concurrent minimum option).

§Chunk Concurrent Minimum

default: 4

Array operations involving multiple chunks can tune the chunk and codec concurrency to improve performance/reduce memory usage. This option sets the preferred minimum chunk concurrency. The concurrency of internal codecs is adjusted to accomodate for the chunk concurrency in accordance with the concurrent target set in the CodecOptions parameter of an encode or decode method.

§Experimental Partial Encoding

default: false

If true, Array::store_chunk_subset and Array::store_array_subset and variants can use partial encoding. This is relevant when using the sharding codec, as it enables subchunks to be written without reading and writing entire shards.

This is an experimental feature for now until it has more comprehensively tested and support is added in the async API.

§Metadata Options

§Codec Store Metadata If Encode Only

default: true

Some codecs perform potentially irreversible transformations during encoding that decoders do not need to be aware of. If this option is false, codecs with this behaviour will not write their metadata. This enables arrays to be consumed by other Zarr V3 implementations that do not support the codec. Currently, this options only affects the bitround codec.

§Metadata Convert Version

default: MetadataConvertVersion::Default (keep existing version)

Determines the Zarr version of metadata created with Array::metadata_opt and Group::metadata_opt. These methods are used internally by the store_metadata and store_metadata_opt methods of crate::array::Array and crate::group::Group.

§Metadata Erase Version

default: MetadataEraseVersion::Default (erase existing version)

The default behaviour for the erase_metadata methods of crate::array::Array and crate::group::Group. Determines whether to erase metadata of a specific Zarr version, the same version as the array/group was created with, or all known versions.

§Include zarrs Metadata

default: true

ArrayMetadataOptions::include_zarrs_metadata defaults to Config::include_zarrs_metadata.

If true, array metadata generated with Array::metadata_opt (used internally by Array::store_metadata) includes the zarrs version and a link to its source code. For example:

"_zarrs": {
   "description": "This array was created with zarrs",
   "repository": "https://github.com/zarrs/zarrs",
   "version": "0.15.0"
 }

§Convert Aliased Extension Names

default: false

If true, then aliased extension names will be replaced by the standard name if metadata is resaved. This sets the default for the association option of crate::array::ArrayMetadataOptions.

§Use Consolidated Metadata

default: UseConsolidatedMetadata::Auto

Controls whether crate::node::Node::open, crate::hierarchy::Hierarchy::open, and their async/_opt variants use the consolidated_metadata field of a Zarr V3 root group instead of listing children from storage. See UseConsolidatedMetadata for the available modes.

Consolidated metadata is a snapshot. If the hierarchy has been modified after the snapshot was written, the consolidated copy may be out of date. Set this to UseConsolidatedMetadata::Never to force re-discovery.

Implementations§

Source§

impl Config

Source

pub fn codec_options(&self) -> CodecOptions

Get the codec options.

Source

pub fn codec_metadata_options(&self) -> CodecMetadataOptions

Get the codec metadata options.

Source

pub fn group_metadata_options(&self) -> GroupMetadataOptions

Get the group metadata options.

Source

pub fn array_metadata_options(&self) -> ArrayMetadataOptions

Get the array metadata options.

Source

pub fn validate_checksums(&self) -> bool

Get the validate checksums configuration.

Source

pub fn set_validate_checksums(&mut self, validate_checksums: bool) -> &mut Self

Set the validate checksums configuration.

Source

pub fn store_empty_chunks(&self) -> bool

Get the store empty chunks configuration.

Source

pub fn set_store_empty_chunks(&mut self, store_empty_chunks: bool) -> &mut Self

Set the store empty chunks configuration.

Source

pub fn codec_concurrent_target(&self) -> usize

Get the codec concurrent target configuration.

Source

pub fn set_codec_concurrent_target( &mut self, concurrent_target: usize, ) -> &mut Self

Set the codec concurrent target configuration.

Source

pub fn chunk_concurrent_minimum(&self) -> usize

Get the chunk concurrent minimum configuration.

Source

pub fn set_chunk_concurrent_minimum( &mut self, concurrent_minimum: usize, ) -> &mut Self

Set the chunk concurrent minimum configuration.

Source

pub fn codec_store_metadata_if_encode_only(&self) -> bool

Get the codec store metadata if encode only configuration.

Source

pub fn set_codec_store_metadata_if_encode_only( &mut self, enabled: bool, ) -> &mut Self

Set the codec store metadata if encode only configuration.

Source

pub fn metadata_convert_version(&self) -> MetadataConvertVersion

Get the metadata convert version configuration.

Source

pub fn set_metadata_convert_version( &mut self, version: MetadataConvertVersion, ) -> &mut Self

Set the metadata convert version configuration.

Source

pub fn metadata_erase_version(&self) -> MetadataEraseVersion

Get the metadata erase version configuration.

Source

pub fn set_metadata_erase_version( &mut self, version: MetadataEraseVersion, ) -> &mut Self

Set the metadata erase version configuration.

Source

pub fn include_zarrs_metadata(&self) -> bool

Get the include zarrs metadata configuration.

Source

pub fn set_include_zarrs_metadata( &mut self, include_zarrs_metadata: bool, ) -> &mut Self

Set the include zarrs metadata configuration.

Source

pub fn experimental_partial_encoding(&self) -> bool

Get the experimental partial encoding configuration.

Source

pub fn set_experimental_partial_encoding( &mut self, experimental_partial_encoding: bool, ) -> &mut Self

Set the experimental partial encoding configuration.

Source

pub fn convert_aliased_extension_names(&self) -> bool

Set the convert aliased extension names configuration.

Source

pub fn set_convert_aliased_extension_names( &mut self, convert_aliased_extension_names: bool, ) -> &mut Self

Set the convert aliased extension names configuration.

Source

pub fn use_consolidated_metadata(&self) -> UseConsolidatedMetadata

Get the use consolidated metadata configuration.

Source

pub fn set_use_consolidated_metadata( &mut self, use_consolidated_metadata: UseConsolidatedMetadata, ) -> &mut Self

Set the use consolidated metadata configuration.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Debug for Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.