morristai commented on code in PR #2499: URL: https://github.com/apache/incubator-opendal/pull/2499#discussion_r1235878362
########## core/src/services/webhdfs/backend.rs: ########## @@ -276,6 +295,88 @@ impl WebhdfsBackend { Ok(req) } + pub(super) fn webhdfs_list_status_batch_request( + &self, + path: &str, + start_after: &Option<String>, + ) -> Result<Request<AsyncBody>> { + let p = build_abs_path(&self.root, path); + + // if it's not the first time to call LISTSTATUS_BATCH, we will add &startAfter=<CHILD> + let start_after_param = match start_after { + Some(sa) if sa.is_empty() => String::new(), + Some(sa) => format!("&startAfter={}", sa), + None => String::new(), + }; + + let mut url = format!( + "{}/webhdfs/v1/{}?op=LISTSTATUS_BATCH{}", + self.endpoint, + percent_encode_path(&p), + start_after_param + ); + if let Some(auth) = &self.auth { + url += format!("&{auth}").as_str(); + } + + let req = Request::get(&url) + .body(AsyncBody::Empty) + .map_err(new_request_build_error)?; + Ok(req) + } + + /// parse the response of LISTSTATUS_BATCH + /// + /// # Note + /// + /// - if the response is 200, return the DirectoryListing + /// - if the response is 404, return an empty DirectoryListing + /// - otherwise, return an error + pub(super) async fn webhdfs_list_status_batch_parse( Review Comment: Fixed, I end up choosing implement parse in both `backend`'s list and `pager`'s next. -- 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-unsubscr...@opendal.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org