Struct Config

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

Global configuration options for the zarrs crate.

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 inner chunks 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

§Experimental Codec Store Metadata If Encode Only

default: false

Some codecs perform potentially irreversible transformations during encoding that decoders do not need to be aware of. If this option is false, experimental codecs with this behaviour will not write their metadata. This enables arrays to be consumed by other zarr3 implementations that do not support the experimental 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/LDeakin/zarrs",
   "version": "0.15.0"
 }

§Experimental Codec Names

default: See the crate root documentation.

Sets the names used when serialising and deserialising the names of experimental codecs. Deserialisation also accepts the standard IDENTIFIER of the codec.

Implementations§

Source§

impl Config

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 experimental_codec_store_metadata_if_encode_only(&self) -> bool

Source

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

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 behaviour configuration.

Source

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

Set the metadata erase version behaviour 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_codec_names(&self) -> &HashMap<String, String>

Get the experimental codec names configuration.

Source

pub fn experimental_codec_names_mut(&mut self) -> &mut HashMap<String, String>

Get a mutable reference to the experimental codec names 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.

Trait Implementations§

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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