Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: Cleanup code for oss writer #1847

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/services/oss/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ impl Accessor for OssBackend {
let result: InitiateMultipartUploadResult =
quick_xml::de::from_reader(bs.reader())
.map_err(new_xml_deserialize_error)?;
let _ = result.bucket;
let _ = result.key;
Some(result.upload_id)
}
_ => return Err(parse_error(resp).await?),
Expand Down Expand Up @@ -950,7 +948,9 @@ struct DeleteObjectsResultError {
#[derive(Default, Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
struct InitiateMultipartUploadResult {
#[cfg(test)]
bucket: String,
#[cfg(test)]
key: String,
upload_id: String,
}
Expand Down
13 changes: 4 additions & 9 deletions core/src/services/oss/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
// under the License.

use async_trait::async_trait;
use bytes::{Buf, Bytes};
use bytes::Bytes;
use http::StatusCode;

use super::backend::MultipartUploadPart;
use super::backend::OssBackend;
use super::error::parse_error;
use crate::ops::OpWrite;
use crate::raw::*;
use crate::services::oss::backend::{CompleteMultipartUploadResult, MultipartUploadPart};
use crate::*;

pub struct OssWriter {
Expand Down Expand Up @@ -128,13 +128,8 @@ impl oio::Write for OssWriter {
.await?;
match resp.status() {
StatusCode::OK => {
let bs = resp.into_body().bytes().await?;
let result: CompleteMultipartUploadResult =
quick_xml::de::from_reader(bs.reader()).map_err(new_xml_deserialize_error)?;
let _ = result.location;
let _ = result.key;
let _ = result.bucket;
let _ = result.etag;
resp.into_body().consume().await?;

Ok(())
}
_ => Err(parse_error(resp).await?),
Expand Down