yahoNanJing commented on code in PR #5543:
URL: https://github.com/apache/arrow-datafusion/pull/5543#discussion_r1138666350
##########
datafusion/execution/src/object_store.rs:
##########
@@ -79,71 +79,42 @@ impl std::fmt::Display for ObjectStoreUrl {
}
}
-/// Provides a mechanism for lazy, on-demand creation of an [`ObjectStore`]
-///
-/// For example, to support reading arbitrary buckets from AWS S3
-/// without instantiating an [`ObjectStore`] for each possible bucket
-/// up front, an [`ObjectStoreProvider`] can be used to create the
-/// appropriate [`ObjectStore`] instance on demand.
-///
-/// See [`ObjectStoreRegistry::new_with_provider`]
-pub trait ObjectStoreProvider: Send + Sync + 'static {
- /// Return an ObjectStore for the provided url, called by
[`ObjectStoreRegistry::get_by_url`]
- /// when no matching store has already been registered. The result will be
cached based
- /// on its schema and authority. Any error will be returned to the caller
+/// Provides a mechanism to get and put object stores.
+pub trait ObjectStoreRegistry: 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>>;
+
+ /// Insert a [`ObjectStore`] with the key of a given url got by
[`get_url_key()`]
+ ///
+ /// If a store with the same url key, it is replaced and returned
+ fn put_with_url(
Review Comment:
Thanks @tustvold for your suggestion. `put_with_url` and `register_store`
are using different strategies for registration. Perhaps it's better to just
use key and value as the parameters for the interface. I'll refine this in the
next commit.
--
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]