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 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
impl Config
Sourcepub fn codec_options(&self) -> CodecOptions
pub fn codec_options(&self) -> CodecOptions
Get the codec options.
Sourcepub fn codec_metadata_options(&self) -> CodecMetadataOptions
pub fn codec_metadata_options(&self) -> CodecMetadataOptions
Get the codec metadata options.
Sourcepub fn group_metadata_options(&self) -> GroupMetadataOptions
pub fn group_metadata_options(&self) -> GroupMetadataOptions
Get the group metadata options.
Sourcepub fn array_metadata_options(&self) -> ArrayMetadataOptions
pub fn array_metadata_options(&self) -> ArrayMetadataOptions
Get the array metadata options.
Sourcepub fn validate_checksums(&self) -> bool
pub fn validate_checksums(&self) -> bool
Get the validate checksums configuration.
Sourcepub fn set_validate_checksums(&mut self, validate_checksums: bool) -> &mut Self
pub fn set_validate_checksums(&mut self, validate_checksums: bool) -> &mut Self
Set the validate checksums configuration.
Sourcepub fn store_empty_chunks(&self) -> bool
pub fn store_empty_chunks(&self) -> bool
Get the store empty chunks configuration.
Sourcepub fn set_store_empty_chunks(&mut self, store_empty_chunks: bool) -> &mut Self
pub fn set_store_empty_chunks(&mut self, store_empty_chunks: bool) -> &mut Self
Set the store empty chunks configuration.
Sourcepub fn codec_concurrent_target(&self) -> usize
pub fn codec_concurrent_target(&self) -> usize
Get the codec concurrent target configuration.
Sourcepub fn set_codec_concurrent_target(
&mut self,
concurrent_target: usize,
) -> &mut Self
pub fn set_codec_concurrent_target( &mut self, concurrent_target: usize, ) -> &mut Self
Set the codec concurrent target configuration.
Sourcepub fn chunk_concurrent_minimum(&self) -> usize
pub fn chunk_concurrent_minimum(&self) -> usize
Get the chunk concurrent minimum configuration.
Sourcepub fn set_chunk_concurrent_minimum(
&mut self,
concurrent_minimum: usize,
) -> &mut Self
pub fn set_chunk_concurrent_minimum( &mut self, concurrent_minimum: usize, ) -> &mut Self
Set the chunk concurrent minimum configuration.
Sourcepub fn codec_store_metadata_if_encode_only(&self) -> bool
pub fn codec_store_metadata_if_encode_only(&self) -> bool
Get the codec store metadata if encode only configuration.
Sourcepub fn set_codec_store_metadata_if_encode_only(
&mut self,
enabled: bool,
) -> &mut Self
pub fn set_codec_store_metadata_if_encode_only( &mut self, enabled: bool, ) -> &mut Self
Set the codec store metadata if encode only configuration.
Sourcepub fn metadata_convert_version(&self) -> MetadataConvertVersion
pub fn metadata_convert_version(&self) -> MetadataConvertVersion
Get the metadata convert version configuration.
Sourcepub fn set_metadata_convert_version(
&mut self,
version: MetadataConvertVersion,
) -> &mut Self
pub fn set_metadata_convert_version( &mut self, version: MetadataConvertVersion, ) -> &mut Self
Set the metadata convert version configuration.
Sourcepub fn metadata_erase_version(&self) -> MetadataEraseVersion
pub fn metadata_erase_version(&self) -> MetadataEraseVersion
Get the metadata erase version configuration.
Sourcepub fn set_metadata_erase_version(
&mut self,
version: MetadataEraseVersion,
) -> &mut Self
pub fn set_metadata_erase_version( &mut self, version: MetadataEraseVersion, ) -> &mut Self
Set the metadata erase version configuration.
Sourcepub fn include_zarrs_metadata(&self) -> bool
pub fn include_zarrs_metadata(&self) -> bool
Get the include zarrs metadata configuration.
Sourcepub fn set_include_zarrs_metadata(
&mut self,
include_zarrs_metadata: bool,
) -> &mut Self
pub fn set_include_zarrs_metadata( &mut self, include_zarrs_metadata: bool, ) -> &mut Self
Set the include zarrs metadata configuration.
Sourcepub fn experimental_partial_encoding(&self) -> bool
pub fn experimental_partial_encoding(&self) -> bool
Get the experimental partial encoding configuration.
Sourcepub fn set_experimental_partial_encoding(
&mut self,
experimental_partial_encoding: bool,
) -> &mut Self
pub fn set_experimental_partial_encoding( &mut self, experimental_partial_encoding: bool, ) -> &mut Self
Set the experimental partial encoding configuration.
Sourcepub fn convert_aliased_extension_names(&self) -> bool
pub fn convert_aliased_extension_names(&self) -> bool
Set the convert aliased extension names configuration.
Sourcepub fn set_convert_aliased_extension_names(
&mut self,
convert_aliased_extension_names: bool,
) -> &mut Self
pub fn set_convert_aliased_extension_names( &mut self, convert_aliased_extension_names: bool, ) -> &mut Self
Set the convert aliased extension names configuration.
Sourcepub fn use_consolidated_metadata(&self) -> UseConsolidatedMetadata
pub fn use_consolidated_metadata(&self) -> UseConsolidatedMetadata
Get the use consolidated metadata configuration.
Sourcepub fn set_use_consolidated_metadata(
&mut self,
use_consolidated_metadata: UseConsolidatedMetadata,
) -> &mut Self
pub fn set_use_consolidated_metadata( &mut self, use_consolidated_metadata: UseConsolidatedMetadata, ) -> &mut Self
Set the use consolidated metadata configuration.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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