Skip to content

azure

Classes:

BlobPointer

Bases: TypedDict

A pointer to a blob in Azure Blob Storage.

Attributes:

  • blob (str) –

    The path to the blob within the container.

  • container (str) –

    The name of the container where the blob is stored.

blob instance-attribute

blob: str

The path to the blob within the container.

container instance-attribute

container: str

The name of the container where the blob is stored.

BlobRouter

Bases: Protocol

A protocol for routing data to Azure Blob Storage by returning a BlobPointer.

BlobStorage

BlobStorage(
    *,
    service_client: BlobServiceClient,
    blob_router: BlobRouter | None,
    path_prefix: str = ""
)

Bases: Storage['BlobPointer']

Storage for Azure Blob data.

Methods:

deserialize_config

deserialize_config(config: str) -> C

Deserialize the configuration from a JSON string.

read_data async

read_data(pointer: BlobPointer) -> bytes

Load data from the given location.

read_data_stream async

read_data_stream(
    pointer: BlobPointer,
) -> AsyncGenerator[bytes]

Load a data stream from the given location.

serialize_config

serialize_config(config: C) -> str

Serialize the configuration to a JSON string.

write_data async

write_data(
    data: bytes, digest: Digest, tags: TagMap
) -> BlobPointer

Save the given value data.

write_data_stream async

write_data_stream(
    data_stream: AsyncIterable[bytes],
    get_digest: GetStreamDigest,
    tags: TagMap,
) -> BlobPointer

Save the given data stream.

simple_blob_router

simple_blob_router(
    container: str, prefix: str = ""
) -> BlobRouter

Create a simple blob router that returns a BlobPointer based on the container and prefix.

Parameters:

  • container

    (str) –

    The name of the Azure Blob Storage container.

  • prefix

    (str, default: '' ) –

    An optional prefix to prepend to the blob path.

Returns:

  • BlobRouter

    A BlobRouter that generates BlobPointers for the specified container and prefix.