You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/08/24 01:53:46 UTC

[incubator-opendal] branch exact-buf-write updated (54ce8b122 -> beb1c7b5f)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a change to branch exact-buf-write
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


    from 54ce8b122 Fix typo
     add 29db37227 docs: auto relaese maven artifacts (#2729)
     add 1ac9b6edf doc(tests): fix test command (#2920)
     add 5c8d9bbfb fix(binding/java): Overwrite default NOTICE file with correct years (#2918)
     new 438ef09c7 Merge remote-tracking branch 'origin/main' into exact-buf-write
     new beb1c7b5f Fix clippy

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/src/main/resources/META-INF/NOTICE        |  2 +-
 core/src/raw/oio/cursor.rs                         | 12 +++--
 core/src/raw/oio/stream/api.rs                     |  6 ++-
 core/src/raw/oio/write/at_least_buf_write.rs       |  8 +--
 core/src/raw/oio/write/exact_buf_write.rs          | 33 +++++++-----
 core/src/raw/oio/write/one_shot_write.rs           |  5 +-
 core/src/services/obs/writer.rs                    |  3 +-
 core/tests/behavior/README.md                      | 10 ++--
 website/docs/contributing/release.md               | 61 ++++++++++++++++++----
 website/docs/contributing/verify.md                | 12 +++++
 10 files changed, 110 insertions(+), 42 deletions(-)
 copy NOTICE => bindings/java/src/main/resources/META-INF/NOTICE (84%)


[incubator-opendal] 01/02: Merge remote-tracking branch 'origin/main' into exact-buf-write

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch exact-buf-write
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit 438ef09c7f752e683bc86bf819ace728c827f72f
Merge: 54ce8b122 5c8d9bbfb
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Aug 24 09:51:58 2023 +0800

    Merge remote-tracking branch 'origin/main' into exact-buf-write

 bindings/java/src/main/resources/META-INF/NOTICE |  5 ++
 core/tests/behavior/README.md                    | 10 ++--
 website/docs/contributing/release.md             | 61 ++++++++++++++++++++----
 website/docs/contributing/verify.md              | 12 +++++
 4 files changed, 72 insertions(+), 16 deletions(-)


[incubator-opendal] 02/02: Fix clippy

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch exact-buf-write
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit beb1c7b5f1e6437654674ac34b9964750a748a50
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Aug 24 09:53:37 2023 +0800

    Fix clippy
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 core/src/raw/oio/cursor.rs                   | 12 ++++++----
 core/src/raw/oio/stream/api.rs               |  6 +++--
 core/src/raw/oio/write/at_least_buf_write.rs |  8 ++++---
 core/src/raw/oio/write/exact_buf_write.rs    | 33 +++++++++++++++++-----------
 core/src/raw/oio/write/one_shot_write.rs     |  5 +++--
 core/src/services/obs/writer.rs              |  3 ++-
 6 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/core/src/raw/oio/cursor.rs b/core/src/raw/oio/cursor.rs
index a10afbf33..7a58c8684 100644
--- a/core/src/raw/oio/cursor.rs
+++ b/core/src/raw/oio/cursor.rs
@@ -314,7 +314,7 @@ impl ChunkedCursor {
     fn concat(&self) -> Bytes {
         let mut bs = BytesMut::new();
         for v in &self.inner {
-            bs.extend_from_slice(&v);
+            bs.extend_from_slice(v);
         }
         bs.freeze()
     }
@@ -499,11 +499,15 @@ impl VectorCursor {
 
 #[cfg(test)]
 mod tests {
+    use pretty_assertions::assert_eq;
+    use rand::thread_rng;
+    use rand::Rng;
+    use rand::RngCore;
+    use sha2::Digest;
+    use sha2::Sha256;
+
     use super::*;
     use crate::raw::oio::StreamExt;
-    use pretty_assertions::assert_eq;
-    use rand::{thread_rng, Rng, RngCore};
-    use sha2::{Digest, Sha256};
 
     #[test]
     fn test_vector_cursor() {
diff --git a/core/src/raw/oio/stream/api.rs b/core/src/raw/oio/stream/api.rs
index 495a4fb22..132fb78fc 100644
--- a/core/src/raw/oio/stream/api.rs
+++ b/core/src/raw/oio/stream/api.rs
@@ -18,10 +18,12 @@
 use std::future::Future;
 use std::pin::Pin;
 use std::sync::Arc;
+use std::task::ready;
+use std::task::Context;
 use std::task::Poll;
-use std::task::{ready, Context};
 
-use bytes::{Bytes, BytesMut};
+use bytes::Bytes;
+use bytes::BytesMut;
 use pin_project::pin_project;
 
 use crate::*;
diff --git a/core/src/raw/oio/write/at_least_buf_write.rs b/core/src/raw/oio/write/at_least_buf_write.rs
index 0add20fd9..91adddd30 100644
--- a/core/src/raw/oio/write/at_least_buf_write.rs
+++ b/core/src/raw/oio/write/at_least_buf_write.rs
@@ -15,12 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use crate::raw::oio::{StreamExt, Streamer};
-use crate::raw::*;
-use crate::*;
 use async_trait::async_trait;
 use bytes::Bytes;
 
+use crate::raw::oio::StreamExt;
+use crate::raw::oio::Streamer;
+use crate::raw::*;
+use crate::*;
+
 /// AtLeastBufWriter is used to implement [`oio::Write`] based on at least buffer strategy: flush
 /// the underlying storage when the buffered size is larger.
 ///
diff --git a/core/src/raw/oio/write/exact_buf_write.rs b/core/src/raw/oio/write/exact_buf_write.rs
index 3afffe1d9..271c8d5a7 100644
--- a/core/src/raw/oio/write/exact_buf_write.rs
+++ b/core/src/raw/oio/write/exact_buf_write.rs
@@ -15,12 +15,15 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use crate::raw::oio::{StreamExt, Streamer};
-use crate::raw::*;
-use crate::*;
+use std::cmp::min;
+
 use async_trait::async_trait;
 use bytes::Bytes;
-use std::cmp::min;
+
+use crate::raw::oio::StreamExt;
+use crate::raw::oio::Streamer;
+use crate::raw::*;
+use crate::*;
 
 /// ExactBufWriter is used to implement [`oio::Write`] based on exact buffer strategy: flush the
 /// underlying storage when the buffered size is exactly the same as the buffer size.
@@ -91,11 +94,11 @@ impl<W: oio::Write> oio::Write for ExactBufWriter<W> {
     /// We know every stream size, we can collect them into a buffer without chain them every time.
     async fn sink(&mut self, size: u64, mut s: Streamer) -> Result<()> {
         // Collect the stream into buffer directly if the buffet is not full.
-        if self.buffer_stream.is_none() {
-            if self.buffer.len() as u64 + size <= self.buffer_size as u64 {
-                self.buffer.push(s.collect().await?);
-                return Ok(());
-            }
+        if self.buffer_stream.is_none()
+            && self.buffer.len() as u64 + size <= self.buffer_size as u64
+        {
+            self.buffer.push(s.collect().await?);
+            return Ok(());
         }
 
         if self.buffer.len() >= self.buffer_size {
@@ -192,13 +195,17 @@ impl<W: oio::Write> oio::Write for ExactBufWriter<W> {
 
 #[cfg(test)]
 mod tests {
+    use log::debug;
+    use pretty_assertions::assert_eq;
+    use rand::thread_rng;
+    use rand::Rng;
+    use rand::RngCore;
+    use sha2::Digest;
+    use sha2::Sha256;
+
     use super::*;
     use crate::raw::oio::StreamExt;
     use crate::raw::oio::Write;
-    use log::debug;
-    use pretty_assertions::assert_eq;
-    use rand::{thread_rng, Rng, RngCore};
-    use sha2::{Digest, Sha256};
 
     struct MockWriter {
         buf: Vec<u8>,
diff --git a/core/src/raw/oio/write/one_shot_write.rs b/core/src/raw/oio/write/one_shot_write.rs
index c2ad25c83..35b1883bf 100644
--- a/core/src/raw/oio/write/one_shot_write.rs
+++ b/core/src/raw/oio/write/one_shot_write.rs
@@ -15,11 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use crate::raw::*;
-use crate::*;
 use async_trait::async_trait;
 use bytes::Bytes;
 
+use crate::raw::*;
+use crate::*;
+
 /// OneShotWrite is used to implement [`Write`] based on one shot operation.
 /// By implementing OneShotWrite, services don't need to care about the details.
 ///
diff --git a/core/src/services/obs/writer.rs b/core/src/services/obs/writer.rs
index f8078a955..d3b1e119f 100644
--- a/core/src/services/obs/writer.rs
+++ b/core/src/services/obs/writer.rs
@@ -23,7 +23,8 @@ use http::StatusCode;
 
 use super::core::*;
 use super::error::parse_error;
-use crate::raw::oio::{MultipartUploadPart, Streamer};
+use crate::raw::oio::MultipartUploadPart;
+use crate::raw::oio::Streamer;
 use crate::raw::*;
 use crate::*;