Skip to content
potluckdb

Storage

Java and Kotlin: also in Python · Node · Go · Rust · Swift · Dart · .NET · C++ · Objective-C

Remotes using storage services through the shared native storage library.

Concepts explains the remote and local store.

Each constructor returns an ordinary remote. Pass it to the same open call and close it the same way. The other reference pages apply to these remotes without change.

// Storage
public static Remote fromS3(S3Options options)
// S3Options
public static Builder builder(String bucket, String namespace)
// S3Options.Builder
public Builder region(String value)
public Builder endpoint(String value)
public Builder forcePathStyle(boolean value)
public Builder credentials(String accessKeyId, String secretAccessKey)
public Builder credentials(
String accessKeyId, String secretAccessKey, String sessionToken
)
public Builder remote(RemoteOptions options)
public S3Options build()

A remote over an S3-compatible bucket.

Credentials come from the AWS chain unless accessKeyId and secretAccessKey are supplied. aws-config resolves the chain itself:

  • Environment
  • Shared configuration and credentials files
  • SSO
  • Web identity
  • Container and instance metadata

A storage service other than AWS is named by endpoint. The AWS chain still supplies credentials unless accessKeyId and secretAccessKey are supplied, so supply the key pair that the service issues. Cloudflare R2 issues a pair with an account endpoint and requires region set to “auto”. MinIO and most self-hosted gateways require forcePathStyle. This addresses the bucket as a path segment instead of a subdomain.

  • bucket: The bucket holding the objects.
  • namespace: The database’s prefix. One bucket can hold many databases.
  • region: The signing region. If absent, the AWS chain selects it.
  • endpoint: The endpoint of a storage service other than AWS.
  • forcePathStyle: Address the bucket as a path segment instead of a subdomain.
  • accessKeyId: An explicit access key. Supply it together with secretAccessKey, or supply neither.
  • secretAccessKey: The secret for accessKeyId.
  • sessionToken: The session token for temporary credentials.
  • remote: Remote concurrency and retention, as elsewhere in the SDK.
// Storage
public static Remote fromGcs(GcsOptions options)
// GcsOptions
public static Builder builder(String bucket, String namespace)
// GcsOptions.Builder
public Builder endpoint(String value)
public Builder serviceAccount(String value)
public Builder remote(RemoteOptions options)
public GcsOptions build()

A remote over a Google Cloud Storage bucket.

Unless serviceAccount is supplied, google-cloud-auth resolves Application Default Credentials in this order:

  • GOOGLE_APPLICATION_CREDENTIALS
  • The gcloud user credentials file
  • The metadata server

If the process has no such chain, pass Google’s service account JSON as JSON text. A storage service other than Google’s is named by endpoint, including gateways and emulators.

  • bucket: The bucket holding the objects.
  • namespace: The database’s prefix. One bucket can hold many databases.
  • endpoint: The endpoint of a storage service other than Google’s.
  • serviceAccount: Google’s service account JSON, as JSON text.
  • remote: Remote concurrency and retention, as elsewhere in the SDK.
// Storage
public static Remote fromAzure(AzureOptions options)
// AzureOptions
public static Builder builder(String account, String container, String namespace)
// AzureOptions.Builder
public Builder endpoint(String value)
public Builder accountKey(String value)
public Builder remote(RemoteOptions options)
public AzureOptions build()

A remote over an Azure Blob Storage container.

Unless accountKey is supplied, azure-identity resolves the Azure credential chain itself:

  • Environment
  • Workload identity
  • Managed identity
  • Azure CLI
  • Developer tools

Pass an account key for a storage service without such a chain. Azurite supplies the well-known devstoreaccount1 pair.

A storage service other than Azure’s is named by endpoint, passed to the library as endpoint_url. Azurite provides one account per port, so its endpoint includes the account as a path segment.

  • account: The storage account holding the container.
  • container: The container holding the objects.
  • namespace: The database’s prefix. One container can hold many databases.
  • endpoint: The endpoint of a storage service other than Azure’s.
  • accountKey: An explicit account key.
  • remote: Remote concurrency and retention, as elsewhere in the SDK.