Xuanwo commented on code in PR #3599:
URL: 
https://github.com/apache/incubator-opendal/pull/3599#discussion_r1401517074


##########
core/src/types/list.rs:
##########
@@ -80,44 +83,81 @@ impl Stream for Lister {
             return Poll::Ready(None);
         }
 
-        if let Some(fut) = self.stating.as_mut() {
-            let (path, rp) = ready!(fut.poll_unpin(cx));
-
-            // Make sure we will not poll this future again.
-            self.stating = None;
-            let metadata = match rp {
-                Ok(rp) => rp.into_metadata(),
+        while self.task_queue.len() < self.task_queue.capacity() {
+            match ready!(self.lister.poll_next(cx)) {

Review Comment:
   we can go to poll stat if `poll_next` returns Pending.



##########
core/src/types/list.rs:
##########
@@ -80,44 +83,81 @@ impl Stream for Lister {
             return Poll::Ready(None);
         }
 
-        if let Some(fut) = self.stating.as_mut() {
-            let (path, rp) = ready!(fut.poll_unpin(cx));
-
-            // Make sure we will not poll this future again.
-            self.stating = None;
-            let metadata = match rp {
-                Ok(rp) => rp.into_metadata(),
+        while self.task_queue.len() < self.task_queue.capacity() {

Review Comment:
   It's better not to add a loop in our `poll_next`, using `if` is enough?



##########
core/src/types/list.rs:
##########
@@ -80,44 +83,81 @@ impl Stream for Lister {
             return Poll::Ready(None);
         }
 
-        if let Some(fut) = self.stating.as_mut() {
-            let (path, rp) = ready!(fut.poll_unpin(cx));
-
-            // Make sure we will not poll this future again.
-            self.stating = None;
-            let metadata = match rp {
-                Ok(rp) => rp.into_metadata(),
+        while self.task_queue.len() < self.task_queue.capacity() {
+            match ready!(self.lister.poll_next(cx)) {
+                Ok(Some(oe)) => {
+                    let (path, metadata) = oe.into_entry().into_parts();
+                    // TODO: we can optimize this by checking the provided 
metakey provided by services.
+                    if metadata.contains_metakey(self.required_metakey) {
+                        // NOTE: we need to maintain the order of entries, 
will consume the task_queue first.
+                        return if self.task_queue.is_empty() {

Review Comment:
   After apply the changes of removing `buf`, I believe we don't need to 
perform such optimize.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to