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
impl Config
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 experimental_codec_store_metadata_if_encode_only(&self) -> bool
pub fn experimental_codec_store_metadata_if_encode_only(&self) -> bool
Get the experimental codec store metadata if encode only configuration.
Sourcepub fn set_experimental_codec_store_metadata_if_encode_only(
&mut self,
enabled: bool,
) -> &mut Self
pub fn set_experimental_codec_store_metadata_if_encode_only( &mut self, enabled: bool, ) -> &mut Self
Set the experimental 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 behaviour 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 behaviour 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_codec_names(&self) -> &HashMap<String, String>
pub fn experimental_codec_names(&self) -> &HashMap<String, String>
Get the experimental codec names configuration.
Sourcepub fn experimental_codec_names_mut(&mut self) -> &mut HashMap<String, String>
pub fn experimental_codec_names_mut(&mut self) -> &mut HashMap<String, String>
Get a mutable reference to the experimental codec names 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.
Trait Implementations§
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> 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> 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