Storage
C++: also in Python · Node · Go · Rust · Swift · Dart · Java and Kotlin · .NET · 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.
potluckdb::storage::from_s3
Section titled “potluckdb::storage::from_s3”inline Remote from_s3(const S3Options &options)
struct S3Options { /// The bucket that holds the objects. std::string bucket; /// The prefix this database lives under, so one bucket can hold /// many. `namespace` is a keyword, and the trailing underscore is /// the only spelling C++ leaves for the field every other SDK calls /// by the bare name. std::string namespace_; /// The region to sign for. Absent leaves it to the AWS chain; /// Cloudflare R2 issues an account endpoint and wants "auto". std::optional<std::string> region; /// A store that is not AWS's own. std::optional<std::string> endpoint; /// Address buckets by path rather than by a virtual host, which is /// what MinIO and most on-premise gateways have DNS for. bool force_path_style = false; /// Credentials come from the AWS chain -- environment, shared /// configuration and credentials files, SSO, web identity, container /// and instance metadata, resolved by `aws-config` itself -- unless /// both of these are given. std::optional<std::string> access_key_id; std::optional<std::string> secret_access_key; std::optional<std::string> session_token; /// Handed to the `Remote` this opens, unchanged. RemoteOptions remote;};A remote over an S3-compatible bucket.
Credentials come from the AWS chain unless access_key_id and secret_access_key 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 access_key_id and secret_access_key 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 force_path_style. 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.force_path_style: Address the bucket as a path segment instead of a subdomain.access_key_id: An explicit access key. Supply it together withsecret_access_key, or supply neither.secret_access_key: The secret foraccess_key_id.session_token: The session token for temporary credentials.remote: Remote concurrency and retention, as elsewhere in the SDK.
potluckdb::storage::from_gcs
Section titled “potluckdb::storage::from_gcs”inline Remote from_gcs(const GcsOptions &options)
struct GcsOptions { /// The bucket that holds the objects. std::string bucket; /// The prefix this database lives under. See `S3Options::namespace_` /// for the underscore. std::string namespace_; /// A store that is not Google's own. std::optional<std::string> endpoint; /// The service account key Google issues, as its own JSON text. /// Absent uses Application Default Credentials. std::optional<std::string> service_account; /// Handed to the `Remote` this opens, unchanged. RemoteOptions remote;};A remote over a Google Cloud Storage bucket.
Unless service_account 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.service_account: Google’s service account JSON, as JSON text.remote: Remote concurrency and retention, as elsewhere in the SDK.
potluckdb::storage::from_azure
Section titled “potluckdb::storage::from_azure”inline Remote from_azure(const AzureOptions &options)
struct AzureOptions { /// The storage account that holds the container. std::string account; /// The container that holds the objects. std::string container; /// The prefix this database lives under. See `S3Options::namespace_` /// for the underscore. std::string namespace_; /// A store that is not Azure's own. Azurite is one account under one /// port, so its endpoint carries the account as a path segment. std::optional<std::string> endpoint; /// An explicit account key. Absent uses the Azure chain. std::optional<std::string> account_key; /// Handed to the `Remote` this opens, unchanged. RemoteOptions remote;};A remote over an Azure Blob Storage container.
Unless account_key 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.account_key: An explicit account key.remote: Remote concurrency and retention, as elsewhere in the SDK.