Skip to main content

Gcs Datastore

@swamp/gcs-datastorev2026.07.25.1· 2d agoDATASTORES
01README

Store data in a Google Cloud Storage bucket with local cache synchronization. Provides distributed locking via GCS generation-based preconditions and bidirectional sync between a local cache directory and GCS. Emits OpenTelemetry spans for GCS operations, lock acquisition/release, and push/pull sync so datastore activity is visible in traces when a TracerProvider is configured. Features shard-first indexing with per-model partition shards under _index/ as the source of truth (v2 repos skip the monolithic index upload entirely), commitSeq-based zero-diff fast path, two-phase sync to narrow the global-lock critical section, SHA-256 content hashing, per-path dirty tracking, namespace-scoped sync for multi-repo shared datastores, configurable transfer concurrency, and configurable per-request timeout.

Authentication

Uses Google Cloud Application Default Credentials (ADC) — no credentials in config. Provide credentials via one of:

  • Environment variable: GOOGLE_APPLICATION_CREDENTIALS pointing to a service account key JSON file
  • User credentials: gcloud auth application-default login
  • Attached service account on GCE, Cloud Run, or GKE

Required IAM Permissions

  • storage.buckets.get
  • storage.objects.create
  • storage.objects.get
  • storage.objects.delete
  • storage.objects.list

The predefined role roles/storage.objectAdmin covers all of these.

Usage

swamp datastore setup @swamp/gcs-datastore \
  --config '{"bucket": "my-bucket", "prefix": "swamp"}' --json
02Datastores1
Google Cloud Storageconfigurable
@swamp/gcs-datastoregcs.ts

Store data in a Google Cloud Storage bucket with local cache synchronization.

Config Fields

FieldTypeDescription
bucketstringGCS bucket name
prefix?stringObject name prefix within the bucket
projectId?stringGCP project ID (defaults to ADC project)
apiEndpoint?stringCustom API endpoint URL (for emulators like fake-gcs-server)
pullConcurrency?numberMaximum concurrent GCS downloads during pull. Default: 50
pushConcurrency?numberMaximum concurrent GCS uploads during push. Default: 25
requestTimeoutMs?numberPer-request timeout in milliseconds. Default: 30000.
03Previous Versions19
2026.07.23.1
2026.07.22.3
2026.07.22.2
2026.07.22.1
2026.07.20.1
2026.07.09.2
2026.07.09.1
2026.07.08.3

Modified 1 datastores

2026.07.08.2
2026.07.08.1
2026.07.02.1
2026.07.01.1
2026.06.30.2
2026.06.30.1
2026.06.26.1
2026.06.24.1
2026.06.05.1
2026.06.03.2
2026.06.03.1
04Stats
A
100 / 100
Downloads
24,820
Archive size
113.1 KB
Verified by Swamp
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
05Platforms
06Labels