contrib: add Google Cloud Storage driver for external payload storage#2366
Open
brucearctor wants to merge 1 commit into
Open
contrib: add Google Cloud Storage driver for external payload storage#2366brucearctor wants to merge 1 commit into
brucearctor wants to merge 1 commit into
Conversation
Add a GCS-backed StorageDriver implementation under contrib/google/gcsdriver,
mirroring the existing S3 driver architecture (contrib/aws/s3driver).
Two-module structure:
- gcsdriver: SDK-agnostic driver + Client interface (zero GCP dependency)
- gcsdriver/gcssdk: Concrete Client backed by cloud.google.com/go/storage
Key features:
- Content-addressable keys (SHA-256) with namespace/workflow/activity scoping
- Concurrent uploads via errgroup with two-phase validation
- Dynamic bucket selection via BucketFunc
- Integrity verification on retrieval
ObjectExists behavior note:
The GCS Go client returns storage.ErrObjectNotExist for both a missing
object in a valid bucket AND for any object in a missing bucket. This
implementation performs an explicit Bucket.Attrs() check (with caching)
to distinguish the two cases, returning (false, error) for a missing
bucket. This differs from the S3 driver which returns (false, nil) for
a missing bucket because the AWS SDK maps HeadObject on a missing bucket
to a generic NotFound. We believe returning an error is more correct per
the Client interface contract ('a non-nil error only when the existence
of the object cannot be determined'), but can align with S3 behavior if
the maintainers prefer consistency.
Resolves temporalio#2364
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a GCS-backed
StorageDriverimplementation undercontrib/google/gcsdriver, mirroring the existing S3 driver architecture (contrib/aws/s3driver).Resolves #2364
Two-module structure
gcsdriverClientinterface (zero GCP dependency)gcsdriver/gcssdkClientbacked bycloud.google.com/go/storageKey features
errgroupwith two-phase validationBucketFuncsync.Map) to avoid redundant RPCsObjectExists behavior note
The GCS Go client returns
storage.ErrObjectNotExistfor both a missing object in a valid bucket and for any object in a missing bucket. This implementation performs an explicitBucket.Attrs()check (with caching) to distinguish the two cases, returning(false, error)for a missing bucket.This differs from the S3 driver which returns
(false, nil)for a missing bucket because the AWS SDK mapsHeadObjecton a missing bucket to a genericNotFound. We believe returning an error is more correct per theClientinterface contract ("a non-nil error only when the existence of the object cannot be determined"), but can align with S3 behavior if the maintainers prefer consistency.Tests
fake-gcs-server(put/get, existence, bucket-not-found, caching, large objects, full driver round-trip)go 1.24.0