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

Add AWS S3 backend #61

Merged
merged 4 commits into from
Nov 12, 2017
Merged

Add AWS S3 backend #61

merged 4 commits into from
Nov 12, 2017

Conversation

laura-barluzzi
Copy link
Contributor

@laura-barluzzi laura-barluzzi commented Oct 17, 2017

This pull request adds a storage backend based on Amazon AWS S3 storage system. See #15

The AWS S3 storage system allows us to treat:

  • Each paste as an Amazon S3 object
  • Each past_id as an object key (or key name)
  • Each metadata as an object metadata (which is accessible in a limited way, and which cannot be merely modified)

You find more information regarding Amazon S3 objects and their data, key, and metadata here.

Due to the lack of options, this PR does not implement any preventive approach for each communication with the Amazon S3 storage (e.g. setting a timeout).

This should be merged after #66 so that unrelated lint errors are fixed.

Pair-programmed with @c-w

@laura-barluzzi laura-barluzzi changed the title adsd AWS S3 storage system adds AWS S3 storage system Oct 17, 2017
@laura-barluzzi laura-barluzzi force-pushed the s3 branch 2 times, most recently from 8270e62 to e82a172 Compare October 17, 2017 13:19
Copy link
Owner

@daknob daknob left a comment

Choose a reason for hiding this comment

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

Hello, I think it's fine, other than a small detail I mentioned in a comment, which may not be true.
If it's resolved, and you can also bring it in sync with the current master, it can be merged!

@_wrap_aws_exception
def does_paste_exist(paste_id):
try:
_s3.Object(_bucket, paste_id).load()
Copy link
Owner

Choose a reason for hiding this comment

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

I assume the load() function will actually download the paste content. If there a different function to check whether a specific key exists? If not, load() is fine, but may cause double or triple downloads of the paste from the server.

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be fine. The documentation isn't entirely clear, but Object.load should just do a minimal (HEAD) request to check if the object exists. Object.get, on the other hand, will do a full (GET) request to download the object's contents.

@daknob
Copy link
Owner

daknob commented Oct 18, 2017

Thanks for another great backend service!

@laura-barluzzi
Copy link
Contributor Author

Hi @daknob, @c-w and I finally fixed the merging conflicts for this PR and we also reduced redundancy of code by moving repeated decorator functions into utils.py .

This is ready to be merged!

@laura-barluzzi laura-barluzzi changed the title adds AWS S3 storage system Add AWS S3 storage system Oct 29, 2017
@laura-barluzzi laura-barluzzi changed the title Add AWS S3 storage system Add AWS S3 backend Oct 29, 2017
@daknob daknob merged commit 79393cc into daknob:master Nov 12, 2017
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