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

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

commit b2eb4d906ec1d8e832fe9f642eeed55dcc073b60
Author: Xuanwo <[email protected]>
AuthorDate: Wed Oct 25 11:40:34 2023 +0800

    Save work
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/layers/complete.rs                          | 12 ++++++------
 core/src/raw/oio/read/into_seekable_read_by_range.rs | 10 ++++++----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/core/src/layers/complete.rs b/core/src/layers/complete.rs
index 82e8066e4..36502fff6 100644
--- a/core/src/layers/complete.rs
+++ b/core/src/layers/complete.rs
@@ -116,10 +116,10 @@ use crate::*;
 pub struct CompleteLayer;
 
 impl<A: Accessor> Layer<A> for CompleteLayer {
-    type LayeredAccessor = CompleteReaderAccessor<A>;
+    type LayeredAccessor = CompleteAccessor<A>;
 
     fn layer(&self, inner: A) -> Self::LayeredAccessor {
-        CompleteReaderAccessor {
+        CompleteAccessor {
             meta: inner.info(),
             inner: Arc::new(inner),
         }
@@ -127,18 +127,18 @@ impl<A: Accessor> Layer<A> for CompleteLayer {
 }
 
 /// Provide complete wrapper for backend.
-pub struct CompleteReaderAccessor<A: Accessor> {
+pub struct CompleteAccessor<A: Accessor> {
     meta: AccessorInfo,
     inner: Arc<A>,
 }
 
-impl<A: Accessor> Debug for CompleteReaderAccessor<A> {
+impl<A: Accessor> Debug for CompleteAccessor<A> {
     fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
         self.inner.fmt(f)
     }
 }
 
-impl<A: Accessor> CompleteReaderAccessor<A> {
+impl<A: Accessor> CompleteAccessor<A> {
     fn new_unsupported_error(&self, op: impl Into<&'static str>) -> Error {
         let scheme = self.meta.scheme();
         let op = op.into();
@@ -351,7 +351,7 @@ impl<A: Accessor> CompleteReaderAccessor<A> {
 }
 
 #[async_trait]
-impl<A: Accessor> LayeredAccessor for CompleteReaderAccessor<A> {
+impl<A: Accessor> LayeredAccessor for CompleteAccessor<A> {
     type Inner = A;
     type Reader = CompleteReader<A, A::Reader>;
     type BlockingReader = CompleteReader<A, A::BlockingReader>;
diff --git a/core/src/raw/oio/read/into_seekable_read_by_range.rs 
b/core/src/raw/oio/read/into_seekable_read_by_range.rs
index 26ac62ba7..5b0c28823 100644
--- a/core/src/raw/oio/read/into_seekable_read_by_range.rs
+++ b/core/src/raw/oio/read/into_seekable_read_by_range.rs
@@ -46,17 +46,17 @@ use crate::*;
 pub fn into_seekable_read_by_range<A: Accessor, R>(
     acc: Arc<A>,
     path: &str,
-    reader: R,
-    offset: u64,
-    size: u64,
+    op: OpRead,
 ) -> ByRangeSeekableReader<A, R> {
     ByRangeSeekableReader {
         acc,
         path: path.to_string(),
+        op,
+
         offset,
         size,
         cur: 0,
-        state: State::Reading(reader),
+        state: State::<R>::Idle,
         last_seek_pos: None,
     }
 }
@@ -65,6 +65,7 @@ pub fn into_seekable_read_by_range<A: Accessor, R>(
 pub struct ByRangeSeekableReader<A: Accessor, R> {
     acc: Arc<A>,
     path: String,
+    op: OpRead,
 
     offset: u64,
     size: u64,
@@ -81,6 +82,7 @@ pub struct ByRangeSeekableReader<A: Accessor, R> {
 
 enum State<R> {
     Idle,
+    Stating(BoxFuture<'static, Result<RpStat>>),
     Sending(BoxFuture<'static, Result<(RpRead, R)>>),
     Reading(R),
 }

Reply via email to