Xuanwo commented on code in PR #1801:
URL:
https://github.com/apache/incubator-opendal/pull/1801#discussion_r1167673694
##########
core/src/services/gcs/backend.rs:
##########
@@ -529,6 +546,23 @@ struct GetObjectJsonResponse {
content_type: String,
}
+#[derive(Clone, Default, Debug, Serialize)]
+#[serde(default, rename_all = "PascalCase")]
+pub struct CompleteMultipartUploadRequestPart {
Review Comment:
DO we still need this?
##########
core/src/services/gcs/writer.rs:
##########
@@ -32,11 +32,28 @@ pub struct GcsWriter {
op: OpWrite,
path: String,
+ upload_location: Option<String>,
+ already_uploaded_chunk: u64,
Review Comment:
`chunk` is not a native idea in gcs. How about use `written` to represents
bytes that already written into gcs?
##########
core/src/services/gcs/writer.rs:
##########
@@ -32,11 +32,28 @@ pub struct GcsWriter {
op: OpWrite,
path: String,
+ upload_location: Option<String>,
Review Comment:
How about use `location`?
##########
core/src/services/gcs/writer.rs:
##########
@@ -32,11 +32,28 @@ pub struct GcsWriter {
op: OpWrite,
path: String,
+ upload_location: Option<String>,
+ already_uploaded_chunk: u64,
+ last_chunk_uploaded: bool,
Review Comment:
How about use `last: Option<Bytes>` instead?
Everytime users called `append`, we do the following thing:
- If last is none, store `bs` into last.
- If last is some, upload last to gcs, and replace with `bs`
While users call `close`:
- If last is none, users not call `append`, we can simply ignore this upload
(I'm not sure about this).
- If last is some, upload this as last chunk.
This way, no extra data need to be resent.
##########
core/src/services/gcs/backend.rs:
##########
@@ -410,16 +411,32 @@ impl Accessor for GcsBackend {
}
async fn write(&self, path: &str, args: OpWrite) -> Result<(RpWrite,
Self::Writer)> {
- if args.append() {
- return Err(Error::new(
- ErrorKind::Unsupported,
- "append write is not supported",
- ));
- }
+ let upload_location = if args.append() {
+ let resp = self.core.gcs_initiate_resumable_upload(path).await?;
+ let status = resp.status();
+
+ match status {
+ StatusCode::OK => {
+ let bs = resp
Review Comment:
We can use
[parse_location](https://github.com/apache/incubator-opendal/blob/main/core/src/raw/http_util/header.rs#L45)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]