Skip to content

Conversation

@aziz-shoko
Copy link
Contributor

@aziz-shoko aziz-shoko commented Jul 24, 2025

Description:

I've added the DynamoDB kv-store and followed the same naming methods as NATS and Badger to stay consistent (Like Set, Get, and Delete operations). The code also largely follows the implementation details of NATS and Badger also for consistentcy and coherency. The only difference is that DynamoDB supports multiple attributes for keys so I made it accept a map of any values rather than just setting and getting strings.

I also ran my own integration tests against it using a local dynamodb container and even tested it against my own AWS account dynamodb. It worked as expected but I didn't commit the integration test file here because both NATS and Badger didn't have any specific implementation testing details. If needed, I can add the integration test file and the steps i took to test it.

Aside from that, all the requirements were met:

  • Implement DynamoDB as a new key-value store in pkg/gofr/datasource/kv-store/dynamo.
  • Logging: Log each operation and failure with context.
  • Tracing: Wrap calls in OpenTelemetry spans.
  • Metrics: Emit Prometheus metrics for operation counts and errors.

@aziz-shoko aziz-shoko mentioned this pull request Jul 24, 2025
@aziz-shoko
Copy link
Contributor Author

Also, this is for issue 2001
#2001

The reason why its one commit is because I didn't want to deal with all the merge conflicts and just made a new branch and copied over.

@aziz-shoko aziz-shoko closed this Jul 25, 2025
@aziz-shoko aziz-shoko force-pushed the aziz-shoko/dynamodb-clean branch from f176e46 to edfae48 Compare July 25, 2025 17:10
@aziz-shoko aziz-shoko reopened this Jul 25, 2025
@aziz-shoko
Copy link
Contributor Author

Closed and Reopened because previous commit was trying to change 40 go.mod files, but now its good for review

@aziz-shoko aziz-shoko force-pushed the aziz-shoko/dynamodb-clean branch from 107874e to f4d6891 Compare July 28, 2025 16:54
@aziz-shoko
Copy link
Contributor Author

@Umang01-hash Please run the pipeline again, I did all the typo and code quality fixes

Copy link
Member

@coolwednesday coolwednesday left a comment

Choose a reason for hiding this comment

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

Hey @aziz-shoko , I would need you to add documentation in docs folder under datasources. Refer to other documentation in datasources section. Also please add the docker container used in the contributing.md file.

You would also need to make changes in externaldb.go, container.go and mock container.go. Refer to this PR for datasource addition structure : #2076

Would also appreciate screenshots of running logs, traces, metrics. Would be easy to pinpoint any issues

optFns ...func(*dynamodb.Options),
) (*dynamodb.PutItemOutput, error)
GetItem(
ctx context.Context,
Copy link
Member

Choose a reason for hiding this comment

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

this should be *gofr.Context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you sure? I am using the function signatures from dynamodb package, switching to gofr.Context breaks it

Copy link
Member

Choose a reason for hiding this comment

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

Hey no it won't break it .... gofr's context implements the context.Context interface. You will not face any issue.

@aziz-shoko
Copy link
Contributor Author

HI @coolwednesday, thank you for the review. But I have a question, should I follow these function signatures? Right now the KVStore interface is only for basic key, value string inputs, but for dynamodb, I had a hashMap being passed in to support multiple types. Should I switch to key, value strings?

@coolwednesday
Copy link
Member

HI @coolwednesday, thank you for the review. But I have a question, should I follow these function signatures? Right now the KVStore interface is only for basic key, value string inputs, but for dynamodb, I had a hashMap being passed in to support multiple types. Should I switch to key, value strings?

If you check the value is actually marshaled and then inserted. you can have a hashMap also just handle the marshalling unmarshalling efficiently.

@aziz-shoko
Copy link
Contributor Author

I am gonna go ahead and close this PR, I had a fundamental misunderstanding of this framework and I don't think this is gonna work. Thank you for your time reviewing it 🙏

@aziz-shoko aziz-shoko closed this Aug 12, 2025
@coolwednesday coolwednesday reopened this Sep 4, 2025
@coolwednesday
Copy link
Member

I will be going ahead and continuing the PR.

@coolwednesday
Copy link
Member

Created #2242 .

@coolwednesday coolwednesday mentioned this pull request Sep 7, 2025
4 tasks
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.

3 participants