-
Notifications
You must be signed in to change notification settings - Fork 66
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
platform: add aws s3 storage #99
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @zojw ! Comments inline.
Apart of comments I'd like to know why remote storage stay under storage
crate and s3 storage stay under platform
crate. It looks like we divide project layout with two nonorthogonal dimensions.
Thanks for review :) @tisonkun add s3 storage under for my understanding, in the storage crate, we only provide default implement (memory, remote, fs..), for third-part storage, users can implement it by their self's crate. platform maybe can be viewed as one third-part implement~ |
@tisonkun I think the discussion started here. My mindset is to put things that don't rely on third-party services in the component crate, and put vendor-related things in the platform together. @zojw I further suggest that we make |
@tisonkun @huachaohuang addressed some comments, PTAL if free, thanks~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is your first PR, let work together to improve it a little bit :)
src/platform/aws/src/s3/storage.rs
Outdated
.map_err(Error::from) | ||
} | ||
|
||
async fn create_new_bucket(&self, name: &str) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move it to an S3Client
, you can rename it to create_bucket
. "create" and "new" are redundant, IMO.
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum Error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may define some common errors instead of simply exporting all these errors in the future. I think users have no idea how to handle these individual errors. But we can leave it this way for now, IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 maybe we can refactor this later, for the platform IMHO, maybe we need still need an error mapping between the vendor's error and engula's error, but it should not be one-one mapping, we can hide some user not care detail, but it seems highly related to upper layer usage, maybe we can do it when upper layer and vendor's logic be clear :)
@huachaohuang you can click the |
Yeah, I have done that before. But it seems that I need to click that every time it is updated. |
@huachaohuang you can do it every time give the first-time contribution a review or when you think it ok to test :) Anyway, tests should be run before you merge the pull request. This restriction is for first-time contribution or on a fork only, you can check out this post. |
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The two outstanding comments aren't blockers IMO.
@zojw please let me know if it is ready. |
Signed-off-by: zojw <robi@hey.com>
except #99 (comment) need some discuss, others are ready @huachaohuang |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM except for https://github.com/engula/engula/pull/99/files#r751275597
src/platform/aws/src/s3/bucket.rs
Outdated
return Ok(()); | ||
} | ||
|
||
while data.len() > UPLOAD_PART_SIZE * 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea is to upload UPLOAD_PART_SIZE
at a time instead of UPLOAD_PART_SIZE * 2
?
Signed-off-by: zojw <robi@hey.com>
Signed-off-by: zojw <robi@hey.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref #68
move demo-1's aws s3 code to here and adapt new
Storage
trait