houqp commented on a change in pull request #950: URL: https://github.com/apache/arrow-datafusion/pull/950#discussion_r698945223
########## File path: datafusion/src/datasource/object_store/local.rs ########## @@ -0,0 +1,173 @@ +// 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. + +//! Object store that represents the Local File System. + +use std::fs::Metadata; +use std::sync::Arc; + +use async_trait::async_trait; +use futures::{stream, AsyncRead, StreamExt}; + +use crate::datasource::object_store::{ + FileMeta, FileMetaStream, ObjectReader, ObjectStore, +}; +use crate::error::DataFusionError; +use crate::error::Result; + +#[derive(Debug)] +/// Local File System as Object Store. +pub struct LocalFileSystem; + +#[async_trait] +impl ObjectStore for LocalFileSystem { + async fn list( + &self, + prefix: &str, + _delimiter: Option<String>, + ) -> Result<FileMetaStream> { + list_all(prefix.to_owned()).await Review comment: naming is hard indeed :D how about `ListEntry` or `ListItem`? we can define it as an enum of `FileMeta` and prefix string to distinguish between regular objects and "folder" prefixes. References: S3 has prefixes returned in the ` <CommonPrefixes>` section: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html GCS has prefixes returned in response object's prefixes property: https://cloud.google.com/storage/docs/json_api/v1/objects/list#response Azure blob is similar to S3 and has prefix strings returned in its `BlobPrefix` section: https://docs.microsoft.com/en-us/rest/api/storageservices/enumerating-blob-resources#DelimitedBlobList -- 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]
