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 2025/05/23 10:45:08 UTC

(opendal) 11/18: Rename

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

xuanwo pushed a commit to branch remove-blocking-api-in-oio-access
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit cb5ef5c01fe6e706ff9413d2f82ff4eabfda22cf
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Fri May 23 17:13:40 2025 +0800

    Rename
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 core/src/blocking/delete.rs                        |  9 +++++----
 core/src/blocking/list.rs                          | 13 +++++++------
 core/src/blocking/operator.rs                      | 22 +++++++++++-----------
 core/src/blocking/read/mod.rs                      |  5 ++---
 .../read/{blocking_reader.rs => reader.rs}         | 11 ++++++-----
 core/src/blocking/write/mod.rs                     |  4 ++--
 .../write/{blocking_writer.rs => writer.rs}        |  9 +++++----
 7 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/core/src/blocking/delete.rs b/core/src/blocking/delete.rs
index 7c54999bf..41d091d63 100644
--- a/core/src/blocking/delete.rs
+++ b/core/src/blocking/delete.rs
@@ -15,18 +15,19 @@
 // specific language governing permissions and limitations
 // under the License.
 
+use crate::Deleter as AsyncDeleter;
 use crate::*;
 
 /// BlockingDeleter is designed to continuously remove content from storage.
 ///
 /// It leverages batch deletion capabilities provided by storage services for efficient removal.
-pub struct BlockingDeleter {
+pub struct Deleter {
     handle: tokio::runtime::Handle,
-    inner: Deleter,
+    inner: AsyncDeleter,
 }
 
-impl BlockingDeleter {
-    pub(crate) fn create(handle: tokio::runtime::Handle, inner: Deleter) -> Result<Self> {
+impl Deleter {
+    pub(crate) fn create(handle: tokio::runtime::Handle, inner: AsyncDeleter) -> Result<Self> {
         Ok(Self { handle, inner })
     }
 
diff --git a/core/src/blocking/list.rs b/core/src/blocking/list.rs
index 0a26efabb..9a4d657c2 100644
--- a/core/src/blocking/list.rs
+++ b/core/src/blocking/list.rs
@@ -17,6 +17,7 @@
 
 use futures::StreamExt;
 
+use crate::Lister as AsyncLister;
 use crate::*;
 
 /// BlockingLister is designed to list entries at given path in a blocking
@@ -26,24 +27,24 @@ use crate::*;
 ///
 /// - Lister implements `Iterator<Item = Result<Entry>>`.
 /// - Lister will return `None` if there is no more entries or error has been returned.
-pub struct BlockingLister {
+pub struct Lister {
     handle: tokio::runtime::Handle,
-    lister: Lister,
+    lister: AsyncLister,
 }
 
 /// # Safety
 ///
 /// BlockingLister will only be accessed by `&mut Self`
-unsafe impl Sync for BlockingLister {}
+unsafe impl Sync for Lister {}
 
-impl BlockingLister {
+impl Lister {
     /// Create a new lister.
-    pub(crate) fn new(handle: tokio::runtime::Handle, lister: Lister) -> Self {
+    pub(crate) fn new(handle: tokio::runtime::Handle, lister: AsyncLister) -> Self {
         Self { handle, lister }
     }
 }
 
-impl Iterator for BlockingLister {
+impl Iterator for Lister {
     type Item = Result<Entry>;
 
     fn next(&mut self) -> Option<Self::Item> {
diff --git a/core/src/blocking/operator.rs b/core/src/blocking/operator.rs
index 5b2124161..e935de9a6 100644
--- a/core/src/blocking/operator.rs
+++ b/core/src/blocking/operator.rs
@@ -375,7 +375,7 @@ impl Operator {
     /// # Ok(())
     /// # }
     /// ```
-    pub fn reader(&self, path: &str) -> Result<blocking::BlockingReader> {
+    pub fn reader(&self, path: &str) -> Result<blocking::Reader> {
         self.reader_options(path, options::ReaderOptions::default())
     }
 
@@ -399,9 +399,9 @@ impl Operator {
         &self,
         path: &str,
         opts: options::ReaderOptions,
-    ) -> Result<blocking::BlockingReader> {
+    ) -> Result<blocking::Reader> {
         let r = self.handle.block_on(self.op.reader_options(path, opts))?;
-        Ok(blocking::BlockingReader::new(self.handle.clone(), r))
+        Ok(blocking::Reader::new(self.handle.clone(), r))
     }
 
     /// Write bytes into given path.
@@ -482,7 +482,7 @@ impl Operator {
     /// # Ok(())
     /// # }
     /// ```
-    pub fn writer(&self, path: &str) -> Result<blocking::BlockingWriter> {
+    pub fn writer(&self, path: &str) -> Result<blocking::Writer> {
         self.writer_options(path, options::WriteOptions::default())
     }
 
@@ -506,9 +506,9 @@ impl Operator {
         &self,
         path: &str,
         opts: options::WriteOptions,
-    ) -> Result<blocking::BlockingWriter> {
+    ) -> Result<blocking::Writer> {
         let w = self.handle.block_on(self.op.writer_options(path, opts))?;
-        Ok(blocking::BlockingWriter::new(self.handle.clone(), w))
+        Ok(blocking::Writer::new(self.handle.clone(), w))
     }
 
     /// Copy a file from `from` to `to`.
@@ -634,8 +634,8 @@ impl Operator {
     /// It leverages batch deletion capabilities provided by storage services for efficient removal.
     ///
     /// Users can have more control over the deletion process by using [`BlockingDeleter`] directly.
-    pub fn deleter(&self) -> Result<blocking::BlockingDeleter> {
-        blocking::BlockingDeleter::create(
+    pub fn deleter(&self) -> Result<blocking::Deleter> {
+        blocking::Deleter::create(
             self.handle.clone(),
             self.handle.block_on(self.op.deleter())?,
         )
@@ -788,7 +788,7 @@ impl Operator {
     /// # Ok(())
     /// # }
     /// ```
-    pub fn lister(&self, path: &str) -> Result<blocking::BlockingLister> {
+    pub fn lister(&self, path: &str) -> Result<blocking::Lister> {
         self.lister_options(path, options::ListOptions::default())
     }
 
@@ -859,9 +859,9 @@ impl Operator {
         &self,
         path: &str,
         opts: options::ListOptions,
-    ) -> Result<blocking::BlockingLister> {
+    ) -> Result<blocking::Lister> {
         let l = self.handle.block_on(self.op.lister_options(path, opts))?;
-        Ok(blocking::BlockingLister::new(self.handle.clone(), l))
+        Ok(blocking::Lister::new(self.handle.clone(), l))
     }
 
     /// Check if this operator can work correctly.
diff --git a/core/src/blocking/read/mod.rs b/core/src/blocking/read/mod.rs
index 334f784f5..57083a521 100644
--- a/core/src/blocking/read/mod.rs
+++ b/core/src/blocking/read/mod.rs
@@ -15,9 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#[allow(clippy::module_inception)]
-mod blocking_reader;
-pub use blocking_reader::BlockingReader;
+mod reader;
+pub use reader::Reader;
 
 mod buffer_iterator;
 pub use buffer_iterator::BufferIterator;
diff --git a/core/src/blocking/read/blocking_reader.rs b/core/src/blocking/read/reader.rs
similarity index 93%
rename from core/src/blocking/read/blocking_reader.rs
rename to core/src/blocking/read/reader.rs
index 777e7c0c3..7d5990444 100644
--- a/core/src/blocking/read/blocking_reader.rs
+++ b/core/src/blocking/read/reader.rs
@@ -19,6 +19,7 @@ use std::ops::RangeBounds;
 
 use bytes::BufMut;
 
+use crate::Reader as AsyncReader;
 use crate::*;
 
 use super::BufferIterator;
@@ -28,18 +29,18 @@ use super::StdReader;
 /// BlockingReader is designed to read data from given path in an blocking
 /// manner.
 #[derive(Clone)]
-pub struct BlockingReader {
+pub struct Reader {
     handle: tokio::runtime::Handle,
-    inner: Reader,
+    inner: AsyncReader,
 }
 
-impl BlockingReader {
+impl Reader {
     /// Create a new blocking reader.
     ///
     /// We don't want to expose those details to users so keep this function
     /// in crate only.
-    pub(crate) fn new(handle: tokio::runtime::Handle, inner: Reader) -> Self {
-        BlockingReader { handle, inner }
+    pub(crate) fn new(handle: tokio::runtime::Handle, inner: AsyncReader) -> Self {
+        Reader { handle, inner }
     }
 
     /// Read give range from reader into [`Buffer`].
diff --git a/core/src/blocking/write/mod.rs b/core/src/blocking/write/mod.rs
index ec7419477..68813d14a 100644
--- a/core/src/blocking/write/mod.rs
+++ b/core/src/blocking/write/mod.rs
@@ -15,8 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
-mod blocking_writer;
-pub use blocking_writer::BlockingWriter;
+mod writer;
+pub use writer::Writer;
 
 mod std_writer;
 pub use std_writer::StdWriter;
diff --git a/core/src/blocking/write/blocking_writer.rs b/core/src/blocking/write/writer.rs
similarity index 93%
rename from core/src/blocking/write/blocking_writer.rs
rename to core/src/blocking/write/writer.rs
index 0552e0051..efe4cc8ea 100644
--- a/core/src/blocking/write/blocking_writer.rs
+++ b/core/src/blocking/write/writer.rs
@@ -16,16 +16,17 @@
 // under the License.
 
 use super::std_writer::StdWriter;
+use crate::Writer as AsyncWriter;
 use crate::*;
 
 /// BlockingWriter is designed to write data into given path in an blocking
 /// manner.
-pub struct BlockingWriter {
+pub struct Writer {
     handle: tokio::runtime::Handle,
-    inner: Writer,
+    inner: AsyncWriter,
 }
 
-impl BlockingWriter {
+impl Writer {
     /// Create a new writer.
     ///
     /// Create will use internal information to decide the most suitable
@@ -33,7 +34,7 @@ impl BlockingWriter {
     ///
     /// We don't want to expose those details to users so keep this function
     /// in crate only.
-    pub(crate) fn new(handle: tokio::runtime::Handle, inner: Writer) -> Self {
+    pub(crate) fn new(handle: tokio::runtime::Handle, inner: AsyncWriter) -> Self {
         Self { handle, inner }
     }