Skip to content

Commit

Permalink
refactor(core/raw): Cleanup not used oio::WriteBuf and `oio::Chunke…
Browse files Browse the repository at this point in the history
…dBytes` after refactor (#4361)

* clean block

Signed-off-by: Xuanwo <[email protected]>

* Refactor exact buf write

Signed-off-by: Xuanwo <[email protected]>

* refactor multipart write

Signed-off-by: Xuanwo <[email protected]>

* Refactor range write

Signed-off-by: Xuanwo <[email protected]>

* Cleanup async body

Signed-off-by: Xuanwo <[email protected]>

* remove chunked bytes

Signed-off-by: Xuanwo <[email protected]>

* Remove write buf

Signed-off-by: Xuanwo <[email protected]>

* Fix exact buf

Signed-off-by: Xuanwo <[email protected]>

---------

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Mar 14, 2024
1 parent 3f8736d commit 48235d5
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 884 deletions.
4 changes: 0 additions & 4 deletions core/src/raw/http_util/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ pub enum AsyncBody {
Empty,
/// Body with bytes.
Bytes(Bytes),
/// Body with chunked bytes.
///
/// This is nearly the same with stream, but we can save an extra box.
ChunkedBytes(oio::ChunkedBytes),
/// Body with stream.
Stream(oio::Streamer),
}
Expand Down
11 changes: 0 additions & 11 deletions core/src/raw/http_util/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,6 @@ impl HttpClient {
req_builder = match body {
AsyncBody::Empty => req_builder.body(reqwest::Body::from("")),
AsyncBody::Bytes(bs) => req_builder.body(reqwest::Body::from(bs)),
AsyncBody::ChunkedBytes(bs) => {
#[cfg(not(target_arch = "wasm32"))]
{
req_builder.body(reqwest::Body::wrap_stream(bs))
}
#[cfg(target_arch = "wasm32")]
{
let bs = oio::WriteBuf::bytes(&bs, bs.len());
req_builder.body(reqwest::Body::from(bs))
}
}
AsyncBody::Stream(s) => {
#[cfg(not(target_arch = "wasm32"))]
{
Expand Down
1 change: 0 additions & 1 deletion core/src/raw/http_util/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ impl MixedPart {
bs.len() as u64,
Some(Box::new(oio::Cursor::from(bs)) as Streamer),
),
AsyncBody::ChunkedBytes(bs) => (bs.len() as u64, Some(Box::new(bs) as Streamer)),
AsyncBody::Stream(stream) => {
let len = parts
.headers
Expand Down
Loading

0 comments on commit 48235d5

Please sign in to comment.