PragmaTwice commented on code in PR #5208:
URL: https://github.com/apache/opendal/pull/5208#discussion_r1810592870
##########
core/src/raw/adapters/kv/api.rs:
##########
@@ -25,10 +26,69 @@ use crate::Capability;
use crate::Scheme;
use crate::*;
+/// ScanIter is the async iterator returned by `Adapter::scan`.
+pub trait Scan: Send + Sync + Unpin {
+ /// Fetch the next key in the current key prefix
+ ///
+ /// `None` means no further key will be returned
+ fn next(&mut self) -> impl Future<Output = Option<Result<String>>> +
MaybeSend;
+}
+
+/// A noop implementation of Scan
+impl Scan for () {
+ async fn next(&mut self) -> Option<Result<String>> {
+ None
+ }
+}
+
+/// A ScanIterator implementation for all trivial non-async iterators
Review Comment:
Hmm I currently use it to quickly refactor the code i.e. lots of these
services just return a Vec. Also I think some of these services don't provide a
batched-fetching method on Scan so it may be useful.
Do you have any idea on this?
--
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]