class documentation

Driver for storing and retrieving Temporal payloads in Google Cloud Storage.

Requires an GCSStorageDriverClient and a bucket. Payloads are keyed by a SHA-256 hash of their serialized bytes, segmented by namespace and workflow/activity identifiers derived from the serialization context.

Warning

This API is experimental.

Method __init__ Constructs the GCS driver.
Method name Return the driver instance name.
Async Method retrieve Retrieves payloads from GCS for the given StorageDriverClaim list.
Async Method store Stores payloads in GCS and returns a StorageDriverClaim for each one.
Method type Return the driver type identifier.
Method _get_bucket Resolve bucket using the configured strategy.
Instance Variable _bucket Undocumented
Instance Variable _client Undocumented
Instance Variable _driver_name Undocumented
Instance Variable _max_payload_size Undocumented
def __init__(self, client: GCSStorageDriverClient, bucket: str | Callable[[StorageDriverStoreContext, Payload], str], driver_name: str = 'gcp.gcsdriver', max_payload_size: int = 50 * 1024 * 1024): (source)

Constructs the GCS driver.

Parameters
client:GCSStorageDriverClientAn GCSStorageDriverClient implementation. Use temporalio.contrib.gcp.gcsdriver.gcloud_aio.new_gcloud_aio_client to wrap a gcloud-aio-storage client.
bucket:str | Callable[[StorageDriverStoreContext, Payload], str]GCS bucket name or a callable that accepts (StorageDriverStoreContext, Payload) and returns a bucket name. A callable allows dynamic per-payload bucket selection.
driver_name:strName of this driver instance. Defaults to "gcp.gcsdriver". Override when registering multiple GCSStorageDriver instances with distinct configurations under the same temporalio.converter.ExternalStorage.drivers list.
max_payload_size:intMaximum serialized payload size in bytes that the driver will accept. Defaults to 52428800 (50 MiB). Raise this value if your workload requires larger payloads; lower it to enforce stricter limits.
def name(self) -> str: (source)

Return the driver instance name.

async def retrieve(self, context: StorageDriverRetrieveContext, claims: Sequence[StorageDriverClaim]) -> list[Payload]: (source)

Retrieves payloads from GCS for the given StorageDriverClaim list.

async def store(self, context: StorageDriverStoreContext, payloads: Sequence[Payload]) -> list[StorageDriverClaim]: (source)

Stores payloads in GCS and returns a StorageDriverClaim for each one.

Payloads are keyed by their SHA-256 hash, so identical serialized bytes share the same GCS object. Deduplication is best-effort because the same Python value may serialize differently across payload converter versions (e.g. proto binary). The returned list is the same length as payloads.

def type(self) -> str: (source)

Return the driver type identifier.

def _get_bucket(self, context: StorageDriverStoreContext, payload: Payload) -> str: (source)

Resolve bucket using the configured strategy.

Undocumented

Undocumented

_driver_name = (source)

Undocumented

_max_payload_size = (source)

Undocumented