Storage
Rust: also in Python · Node · Go · Swift · Dart · Java and Kotlin · .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.
potluckdb::storage::from_s3
Section titled “potluckdb::storage::from_s3”// potluckdb::storage
pub fn from_s3(options: S3Options) -> Result<StorageRemote>
// S3Options
pub fn new(bucket: impl Into<String>, namespace: impl Into<String>) -> Self
pub fn region(mut self, region: impl Into<String>) -> Self
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self
pub fn force_path_style(mut self, force_path_style: bool) -> Self
pub fn credentials( mut self, access_key_id: impl Into<String>, secret_access_key: impl Into<String>, session_token: Option<String>,) -> Self
pub fn remote(mut self, options: RemoteOptions) -> SelfA 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”// potluckdb::storage
pub fn from_gcs(options: GcsOptions) -> Result<StorageRemote>
// GcsOptions
pub fn new(bucket: impl Into<String>, namespace: impl Into<String>) -> Self
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self
pub fn service_account(mut self, key: impl Into<String>) -> Self
pub fn remote(mut self, options: RemoteOptions) -> SelfA 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”// potluckdb::storage
pub fn from_azure(options: AzureOptions) -> Result<StorageRemote>
// AzureOptions
pub fn new( account: impl Into<String>, container: impl Into<String>, namespace: impl Into<String>,) -> Self
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self
pub fn account_key(mut self, key: impl Into<String>) -> Self
pub fn remote(mut self, options: RemoteOptions) -> SelfA 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.