You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/11 01:12:55 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5543: Introduce ObjectStoreManager trait for the ObjectStoreRegistry to provide polymorphism for get_by_url

alamb commented on code in PR #5543:
URL: https://github.com/apache/arrow-datafusion/pull/5543#discussion_r1133000601


##########
datafusion/execution/src/object_store.rs:
##########
@@ -89,6 +89,138 @@ pub trait ObjectStoreProvider: Send + Sync + 'static {
     fn get_by_url(&self, url: &Url) -> Result<Arc<dyn ObjectStore>>;
 }
 
+/// Provides a mechanism to get and put object stores.
+pub trait ObjectStoreManager: Send + Sync + std::fmt::Debug + 'static {
+    /// If a store with the same schema and host existed before, it is replaced and returned
+    fn register_store(
+        &self,
+        scheme: &str,
+        host: &str,
+        store: Arc<dyn ObjectStore>,
+    ) -> Option<Arc<dyn ObjectStore>>;
+
+    /// Get a suitable store for the provided URL. For example:
+    ///
+    /// - URL with scheme `file:///` or no schema will return the default LocalFS store
+    /// - URL with scheme `s3://bucket/` will return the S3 store
+    /// - URL with scheme `hdfs://hostname:port/` will return the hdfs store
+    fn get_by_url(&self, url: &Url) -> Result<Arc<dyn ObjectStore>>;

Review Comment:
   I am sorry I am missing something -- how is this different than 
   
   https://github.com/apache/arrow-datafusion/blob/860918d17b6bde396b04d718ee1c76d93054bf11/datafusion/execution/src/object_store.rs#L89
   
   ?
   
   > While ObjectStoreManager focuses on the polymorphism of how to get an ObjectStore by get_by_url.
   
   It seems like the only function of `ObjectStoreProvider` is a polymorphic `get_by_url` 🤔 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org