Skip to content

abczarr.abc.capabilities

The capability vocabulary shared by nodes and stores.

Almost every operation on a store or a node works one way or another, because abczarr falls back to building an operation from simpler ones when a backend has no direct support for it. The useful question is therefore rarely whether an operation works at all, but whether it is fast on the current backend or built up from something simpler. Support answers that question in three states. [supports][abczarr.abc.capabilities.SupportsCapabilities.supports] collapses those three states to a plain bool for a caller that only needs a yes or a no.

Two granularities of name live here. A coarse capability is a broad feature a caller checks before committing to an operation. The named coarse capabilities are collected in KNOWN_CAPABILITIES, and include "sharding", "async", "listing", "partial_read" and "transactions".

A feature key is a fine-grained, namespaced name for a single codec, chunk grid, chunk-key encoding, or data type, such as "v3:codec:zstd", "v2:filter:delta", or "v3:chunk_grid:rectilinear". Feature keys are open-ended. A driver declares the ones it has, and a query about an unknown one simply answers Support.NONE. Build a feature key with feature_key.

Attributes

KNOWN_CAPABILITIES module-attribute

KNOWN_CAPABILITIES = frozenset({'sharding', 'async', 'consolidated_metadata', 'codecs_v2', 'codecs_v3', 'listing', 'writes', 'deletes', 'partial_read', 'partial_write', 'transactions', 'atomic_transactions'})

Classes

Support

Bases: Enum

How well a driver provides a capability.

NATIVE means the backend performs the operation directly, the fast path. SYNTHESIZED means abczarr builds the operation from simpler ones. The result is correct, but possibly slower than a backend that performs the operation directly. NONE means the operation is not available at all, and raises UnsupportedZarrOperation.

bool(support) is True unless the value is NONE. A plain truth test therefore answers whether the operation can happen at all, regardless of how.

Example

>>> bool(Support.NATIVE), bool(Support.SYNTHESIZED)
(True, True)
>>> bool(Support.NONE)
False

Attributes

NATIVE class-attribute instance-attribute
NATIVE = 'native'
SYNTHESIZED class-attribute instance-attribute
SYNTHESIZED = 'synthesized'
NONE class-attribute instance-attribute
NONE = 'none'

Methods:

__bool__
__bool__() -> bool

Functions:

feature_key

feature_key(version: str, kind: str, name: str) -> str

Build a fine-grained feature key from its three parts.

feature_key("v3", "codec", "zstd") returns "v3:codec:zstd". version must be one of :data:FEATURE_VERSIONS and kind one of :data:FEATURE_KINDS. name is the codec, chunk grid, or data type name as it appears in the metadata. Validating the two fixed parts here turns a typo into an immediate error, instead of a key that would otherwise never match anything.