flaneur2020 commented on code in PR #6283: URL: https://github.com/apache/opendal/pull/6283#discussion_r2251565923
########## integrations/object_store/src/service/lister.rs: ########## @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::future::Future; +use std::sync::Arc; +use tokio::sync::Mutex; + +use futures::{stream::BoxStream, StreamExt}; +use object_store::{ObjectMeta, ObjectStore}; +use opendal::raw::*; +use opendal::*; + +use super::error::parse_error; + +pub struct ObjectStoreLister { + stream: Arc<Mutex<BoxStream<'static, object_store::Result<ObjectMeta>>>>, +} + +impl ObjectStoreLister { + pub(crate) async fn new( + store: Arc<dyn ObjectStore + 'static>, + path: &str, + args: OpList, + ) -> Result<Self> { + // If start_after is specified, use list_with_offset + let mut stream = if let Some(start_after) = args.start_after() { Review Comment: iiuc, this method does not contain `.await` point, so i guess constructing this `stream` is not a blocking operation? the blocking operation will be delayed in the await points in the `next()`, am i understand this right? 🫨 ########## integrations/object_store/src/service/lister.rs: ########## @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::future::Future; +use std::sync::Arc; +use tokio::sync::Mutex; + +use futures::{stream::BoxStream, StreamExt}; +use object_store::{ObjectMeta, ObjectStore}; +use opendal::raw::*; +use opendal::*; + +use super::error::parse_error; + +pub struct ObjectStoreLister { + stream: Arc<Mutex<BoxStream<'static, object_store::Result<ObjectMeta>>>>, +} + +impl ObjectStoreLister { + pub(crate) async fn new( + store: Arc<dyn ObjectStore + 'static>, + path: &str, + args: OpList, + ) -> Result<Self> { + // If start_after is specified, use list_with_offset + let mut stream = if let Some(start_after) = args.start_after() { Review Comment: iiuc, this method does not contain `.await` point, so i guess constructing this `stream` is not a blocking operation? the blocking operation will be delayed in the await points in the `next()`, do i understand this right? 🫨 -- 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