Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstore/awsdynamodb: Supporting the AWS V2 SDK #3519

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Maldris
Copy link

@Maldris Maldris commented Jan 31, 2025

Resolved #3458

A somewhat quick and dirty conversion to using the AWS V2 SDK rather than the deprecated V1.

Due to the delays in my finding time to work on this I prioritised getting the functionality migrated to mitigate any risk from API drift form the deprecated V1 SDK.

The main sections that warrant further discussion:

  • codec behaviour could be handled better with type switches now, but may be a follow up task
  • url opener doesn't use a configuration override any more, most of this is handled by V2ConfigFromURLParams, but is worth review
  • error handling using an As pattern and I've declared all the as targets in a block which is likely less memory efficient, but simple to read, should another approach be used?

…es, returning that concrete type to avoid unnecessary type assertion
Copy link

google-cla bot commented Jan 31, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@jba jba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We appreciate the effort you put into this. However, there is a lot of changed code here, including at least two breaking changes. How does the docstore user benefit from the switch to the new API?

Note that the breaking changes are unlikely to be approved, because they would require a v2 of the main module.

@@ -36,6 +37,7 @@ aws dynamodb create-table \
# The docstore-test-2 table has both a partition and a sort key, and two indexes.

aws dynamodb create-table \
--region us-east-2 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line different?

@@ -75,8 +69,6 @@ const Scheme = "dynamodb"
// See https://godoc.org/gocloud.dev/aws#ConfigFromURLParams for supported query
// parameters for overriding the aws.Session from the URL.
type URLOpener struct {
// ConfigProvider must be set to a non-nil value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change.

if err != nil {
return nil, "", "", "", nil, fmt.Errorf("open collection %s: %v", u, err)
}
return db, tableName, partitionKey, sortKey, opts, nil
}

// Dial gets an AWS DynamoDB service client.
func Dial(p client.ConfigProvider) (*dyn.DynamoDB, error) {
if p == nil {
func Dial(p aws.Config) (*dyn.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docstore/awsdynamodb: Support AWS SDK V2
2 participants