Closed mikkeloscar closed 7 years ago
@harti2006 & @dryewo thanks for the comments about exception handling. Since that code was already there (I only renamed some of it) and it doesn't really relate to this PR, I think it would make sense to address those issues in a separate PR. Are you ok with that?
@harti2006 mind reviewing the latest changes which uses defmulti
instead of defprotocol
? :)
:+1:
:+1:
This is the first step to address #33
It solves the issue that S3 related code was used directly everywhere making it hard to use another bucket storage service in place of S3 e.i. Google Cloud Storage.
To solve this I have defined a protocol
BucketStorage
and used this protocol wherever s3 functions was previously called directly in the code. I have also changed theS3Exception
to the more general nameStorageException
.This PR only implements the s3 version of
BucketStorage
so it will work like before. I would like to get this reviewed before providing the Google Cloud Storage implementation in another PR.It does not deal with how we determine if a bucket is in s3 or in another service. I would also like to discuss this (can move it to a separate issue if you prefer).
The easiest solution would be to just derive the bucket type from the bucket name, but a more robust solution would probably be to add a flag to the mint storage defining what service the bucket belongs to.
What do you think about this?
Lastly regarding the Google Cloud Storage integration. As I understand from working on this, it will cause problems (racing) if you were to run mint-worker in AWS and GCP at the same time. Do you have any idea how we could solve that issue? One solution could be to just run the worker in AWS and then setup a proxy in GCP that can deal with the bucket permissions for google cloud storage, but it's possible not the best solution and I would like to hear your opinion on this matter.