azuredol.recipes#
Convenience wrappers and factories for azuredol.
Layer C of the architecture. Built only by composition over Layer B (base.py).
See misc/docs/architecture.md Layer C.
Module Attributes
Text-typed values (str ↔ bytes via UTF-8). |
|
JSON-typed values (dict/list/scalar ↔ bytes via |
|
Pickle-typed values (Python objects ↔ bytes via |
|
|
Functions
|
Build a ready-to-use |
|
|
|
A |
- azuredol.recipes.AppendBlobStore = functools.partial(<class 'azuredol.base.ContainerStore'>, blob_type=<BlobType.APPENDBLOB: 'AppendBlob'>)#
ContainerStorewhose__setitem__creates append blobs by default.Recall the Mapping caveat:
store[k] = von an append blob still creates a new blob (overwrite=True) — it does NOT append to an existing blob. For incremental appends useBlobHandle(container, blob).append(data).
- azuredol.recipes.AzureJsonStore#
JSON-typed values (dict/list/scalar ↔ bytes via
json).
- azuredol.recipes.AzurePickleStore#
Pickle-typed values (Python objects ↔ bytes via
pickle).
- azuredol.recipes.AzureTextStore#
Text-typed values (str ↔ bytes via UTF-8).
- azuredol.recipes.azure_store(container, *, prefix='', connection=None, credential=None, connection_string=None, account_url=None, account_key=None, create_container_if_missing=False, blob_type=BlobType.BLOCKBLOB, value_codec=None)[source]#
Build a ready-to-use
ContainerStore(or codec-wrapped variant) in one call.This is the “simple things simple” entry point. For complex configurations construct
AzureConnectionandContainerStoredirectly.- Parameters:
container (
str) – Container name.prefix (
str) – Blob-name prefix to scope all keys.connection (
Union[AzureConnection,str,dict,None]) – AnAzureConnection(or anythingAzureConnection.from_anythingaccepts) to reuse a service client. Mutually exclusive with the explicitcredential/connection_string/account_*kwargs.credential (
Any) – Forwarded toAzureConnectionwhenconnectionis None.connection_string (
Optional[str]) – Forwarded toAzureConnectionwhenconnectionis None.account_url (
Optional[str]) – Forwarded toAzureConnectionwhenconnectionis None.account_key (
Optional[str]) – Forwarded toAzureConnectionwhenconnectionis None.create_container_if_missing (
bool) – Create the container on first use if absent.blob_type (
BlobType) – Default blob type for writes.value_codec (
Optional[Callable]) – A decorator that, given a class, returns a wrapped class. Typicallytyped_codec(decode, encode). A baredol.wrap_kvs(...)breaks the trailing-slash sub-store (i2mint/azuredol#4). When None (default), bytes pass through.
- Returns:
A
ContainerStoreinstance, possibly codec-wrapped.
- azuredol.recipes.typed_codec(decode, encode)[source]#
typed_storeas a class decorator: the shapeazure_store(value_codec=...)takes.>>> import json >>> codec = typed_codec(json.loads, lambda o: json.dumps(o).encode()) >>> callable(codec) True
- Return type:
- azuredol.recipes.typed_store(decode, encode, *, base=<class 'azuredol.base.ContainerStore'>)[source]#
A
base(defaultContainerStore) class with valuesdecode(bytes)/encode(obj) -> bytes.Unlike a bare
wrap_kvs(ContainerStore, obj_of_data=..., data_of_obj=...), the trailing-slash sub-store convention keeps working:store['2026/']comes back as a sub-store of the same typed class, instead of being fed todecode(i2mint/azuredol#4).