Skip to main content

State tracking utility using Blob Storage

Project description

Azure Function State Storage

A simple key-value storage implementation using Azure Blob Storage as backend.

Features

  • Key-value storage with string values
  • Automatic container creation
  • Time marker functionality
  • Thread-safe operations

Installation

pip install az-func-state

Usage

from azfuncstate import AzFuncState

# Initialize with your connection string
conn_str = "YOUR_CONNECTION_STRING"
state = AzFuncState(connection_string=conn_str, container_name="mystate")

# Basic key-value operations
state.set("user:123", "active")
status = state.get("user:123")  # Returns "active"

# Time marker operations
state.set_time_marker("last_updated")
last_update = state.get_time_marker("last_updated")

API Reference

AzFuncState(connection_string: str, container_name: str)

Initialize the state storage.

  • connection_string: Azure Storage account connection string
  • container_name: Name of the container to use

Methods

set(key: str, value: str) -> None

Store a key-value pair.

get(key: str) -> Optional[str]

Retrieve a value by key. Returns None if key doesn't exist.

set_time_marker(key: str) -> None

Store current UTC timestamp under the given key.

get_time_marker(key: str) -> datetime

Retrieve a stored timestamp. Raises ValueError if key doesn't exist.

Requirements

  • Python 3.12+
  • azure-storage-blob package

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

az_func_state-0.1.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

az_func_state-0.1.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file az_func_state-0.1.1.tar.gz.

File metadata

  • Download URL: az_func_state-0.1.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for az_func_state-0.1.1.tar.gz
Algorithm Hash digest
SHA256 38a2788dc9e90f9a361df8468415114e3d6a355c8ad1cf6c5a68ad8275722c4c
MD5 11b3d9d8fcbc48e6d93d9c924e9eedd3
BLAKE2b-256 4a7100b851687ab3eb79e47d011f0880c2490c9bc0f3563439ecfe6b0866f35a

See more details on using hashes here.

File details

Details for the file az_func_state-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: az_func_state-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for az_func_state-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3597cc75d3ed0fbaf932ea06e7c5f687f664206edc9ed24966b2373cb37b0f2e
MD5 ff21b350bfa1cd883da5de865850bcc2
BLAKE2b-256 24f5b929b4173fc766a60ca11689ba8de745954e61caa67126c9cb6c9da729d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page