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

S3 Backend MVP #75

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

Conversation

joshpmcghee
Copy link
Contributor

A simple implementation for an S3 backend. I've tested and it "works" on my AWS(Screenshots).

The diff should become easier to read with the import renaming landed.

Copy link
Owner

@dinowernli dinowernli left a comment

Choose a reason for hiding this comment

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

Very cool, thanks for putting this together. Just a few nits.

sess := session.Must(session.NewSession())

s3Client := s3.New(sess)
getOutput, err := s3Client.GetObject(&s3.GetObjectInput{
Copy link
Owner

Choose a reason for hiding this comment

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

Seems like there's an easily accessible GetObjectWithContext method [1]. Given that we already have a context passed in, could we call that instead? Here and below.

[1] https://github.com/aws/aws-sdk-go/blob/master/service/s3/api.go#L2969

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's pretty great that they support this now 🎉

}

func (b *s3Backend) read(_ context.Context, id string) ([]byte, error) {
sess := session.Must(session.NewSession())
Copy link
Owner

Choose a reason for hiding this comment

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

From the docs [1] it seems that these sessions (or perhaps even the client?) are designed to be cached/reused. Should we perahps store one in the backend object rather than creating it on every call? Here and below.

[1] https://docs.aws.amazon.com/sdk-for-go/api/aws/session/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like storing the client makes sense for now. That may change, but it's a detail that doesn't impact the interface.

@dinowernli
Copy link
Owner

Let me know when this is ready for review. I'm assuming it currently isn't because it still includes all the now-merged renaming changes.

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.

2 participants