Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve ability to control dynamo creds cache (#1870)
Exposes `AwsCredentialAdapter` for purpose of allowing its cache to be used by the dynamo client. This is necessary to get around a timeout loading credentials ... Currently dynamo client default to lazy_builder https://docs.rs/aws-sdk-dynamodb/0.34.0/src/aws_sdk_dynamodb/config.rs.html#790 This lazy cache has a 5 second timeout loading credentials: https://github.com/smithy-lang/smithy-rs/blob/e78c60dbf169403eedceb1b718b862b0c5e5ee09/aws/rust-runtime/aws-credential-types/src/cache/lazy_caching.rs#L93 This change allows the caller to more easily pass their own `ProvideCredentials` implementation and rely on the caching built into `AwsCredentialAdapter`. ```rs use aws_config::default_provider::credentials::DefaultCredentialsChain; use aws_credential_types::provider::SharedCredentialsProvider; use lance::dataset::ReadParams; use lance_io::object_store::{AwsCredentialAdapter, ObjectStoreParams}; use vectordb::Database; let creds_provider = Arc::new(AwsCredentialAdapter::new( Arc::new(SharedCredentialsProvider::new(DefaultCredentialsChain::builder().build().await)), ObjectStoreParams::default().s3_credentials_refresh_offset, )); let db = Database::connect("s3://my-bucket/my-db?engine=ddb&ddbTableName=my-dyn-table").await.unwrap(); let table = db.open_table_with_params("my-table", ReadParams { store_options: Some(ObjectStoreParams { aws_credentials: Some(creds_provider), ..Default::default() }), ..ReadParams::default() }).await.unwrap(); ```
- Loading branch information