Xuanwo commented on code in PR #3599:
URL:
https://github.com/apache/incubator-opendal/pull/3599#discussion_r1399896942
##########
core/src/types/list.rs:
##########
@@ -81,42 +90,73 @@ impl Stream for Lister {
}
if let Some(fut) = self.stating.as_mut() {
- let (path, rp) = ready!(fut.poll_unpin(cx));
+ let entry = 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(),
- Err(err) => {
- self.errored = true;
- return Poll::Ready(Some(Err(err)));
- }
- };
- return Poll::Ready(Some(Ok(Entry::new(path, metadata))));
+ return Poll::Ready(Some(entry));
Review Comment:
If returning entry is an error, we should set `self.errored = true;`
accordingly.
##########
core/src/types/list.rs:
##########
@@ -81,42 +90,73 @@ impl Stream for Lister {
}
if let Some(fut) = self.stating.as_mut() {
- let (path, rp) = ready!(fut.poll_unpin(cx));
+ let entry = 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(),
- Err(err) => {
- self.errored = true;
- return Poll::Ready(Some(Err(err)));
- }
- };
- return Poll::Ready(Some(Ok(Entry::new(path, metadata))));
+ return Poll::Ready(Some(entry));
}
- match ready!(self.lister.poll_next(cx)) {
- Ok(Some(oe)) => {
- let (path, metadata) = oe.into_entry().into_parts();
- if metadata.contains_metakey(self.required_metakey) {
- return Poll::Ready(Some(Ok(Entry::new(path, metadata))));
+ if !self.task_queue.is_empty() {
+ let task = self.task_queue.pop_back();
+ let fut = async move {
+ if let Some(task) = task {
+ let (path, rp) = task.await.map_err(|err| {
Review Comment:
We need to create two futures for one stat every time, seems not cool.
Maybe we can remove `stating`, and just polling
`self.task_queue.first_mut()`. We can push new feature into the task queue if
there are capacity and poll `first_mut` returns `Pending`?
--
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]