You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "infdahai (via GitHub)" <gi...@apache.org> on 2023/05/25 10:25:24 UTC
[GitHub] [incubator-opendal] infdahai commented on a diff in pull request #2323: refactor(core): Implement RFC-2299 for list_with
infdahai commented on code in PR #2323:
URL: https://github.com/apache/incubator-opendal/pull/2323#discussion_r1205314729
##########
core/src/types/operator/operator.rs:
##########
@@ -1393,28 +1402,36 @@ impl Operator {
/// # Ok(())
/// # }
/// ```
- pub async fn scan(&self, path: &str) -> Result<Lister> {
+ pub fn scan(&self, path: &str) -> FutureList {
let path = normalize_path(path);
- if !validate_path(&path, EntryMode::DIR) {
- return Err(Error::new(
- ErrorKind::NotADirectory,
- "the path trying to scan should end with `/`",
- )
- .with_operation("list")
- .with_context("service", self.info().scheme().into_static())
- .with_context("path", &path));
- }
+ let fut = FutureList(OperatorFuture::new(
+ self.inner().clone(),
+ path,
+ OpList::default(),
+ |inner, path, _args| {
+ let fut = async move {
+ if !validate_path(&path, EntryMode::DIR) {
+ return Err(Error::new(
+ ErrorKind::NotADirectory,
+ "the path trying to scan should end with `/`",
+ )
+ .with_operation("list")
+ .with_context("service", inner.info().scheme().into_static())
+ .with_context("path", &path));
+ }
- let (_, pager) = self
- .inner()
- .list(&path, OpList::new().with_delimiter(""))
- .await?;
+ let (_, pager) = inner.list(&path, OpList::new().with_delimiter("")).await?;
Review Comment:
I don't know how this statement is processed.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org