ExZarr.Storage.Backend.AzureBlob (ExZarr v1.1.0)

View Source

Azure Blob Storage backend for Zarr arrays.

Stores chunks and metadata in Microsoft Azure Blob Storage, providing enterprise-grade cloud storage with global availability.

Configuration

Requires the following options:

  • :account_name - Azure storage account name (required)
  • :account_key - Azure storage account key (required)
  • :container - Blob container name (required)
  • :prefix - Blob prefix/path within container (optional, default: "")

Dependencies

Requires the azurex package:

{:azurex, "~> 0.3"}

Example

# Register the Azure Blob backend
:ok = ExZarr.Storage.Registry.register(ExZarr.Storage.Backend.AzureBlob)

# Create array with Azure Blob storage
{:ok, array} = ExZarr.create(
  shape: {1000, 1000},
  chunks: {100, 100},
  dtype: :float64,
  storage: :azure_blob,
  account_name: "mystorageaccount",
  account_key: System.get_env("AZURE_STORAGE_KEY"),
  container: "zarr-data",
  prefix: "experiments/array1"
)

# Write and read data
ExZarr.Array.set_slice(array, data, start: {0, 0}, stop: {100, 100})
{:ok, result} = ExZarr.Array.get_slice(array, start: {0, 0}, stop: {100, 100})

Blob Structure

Arrays are stored with the following blob paths:

container/prefix/.zarray           # Metadata
container/prefix/0.0               # Chunk at index (0, 0)
container/prefix/0.1               # Chunk at index (0, 1)

Performance Considerations

  • Use blob block size appropriate for chunk sizes
  • Consider using Azure CDN for read-heavy workloads
  • Configure appropriate access tiers (Hot/Cool/Archive)
  • Use SAS tokens for delegated access

Error Handling

Azure Blob errors are returned as {:error, reason} tuples. Common errors:

  • :container_not_found - Container doesn't exist
  • :access_denied - Insufficient permissions
  • :network_error - Network connectivity issues