pub struct ObjectStoreRegistry { /* private fields */ }Expand description
A registry of object store providers.
Use Self::default() to create one with the available default providers.
This includes (depending on features enabled):
memory: An in-memory object store.file: A local file object store, with optimized code paths.file-object-store: A local file object store that uses the ObjectStore API, for all operations. Used for testing with ObjectStore wrappers.s3: An S3 object store.s3+ddb: An S3 object store with DynamoDB for metadata.az: An Azure Blob Storage object store.gs: A Google Cloud Storage object store.
Use Self::empty() to create an empty registry, with no providers registered.
The registry also caches object stores that are currently in use. It holds
weak references to the object stores, so they are not held onto. If an object
store is no longer in use, it will be removed from the cache on the next
call to either Self::active_stores() or Self::get_store().
Implementations§
Source§impl ObjectStoreRegistry
impl ObjectStoreRegistry
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create a new registry with no providers registered.
Typically, you want to use Self::default() instead, so you get the
default providers.
Sourcepub fn get_provider(&self, scheme: &str) -> Option<Arc<dyn ObjectStoreProvider>>
pub fn get_provider(&self, scheme: &str) -> Option<Arc<dyn ObjectStoreProvider>>
Get the object store provider for a given scheme.
Sourcepub fn active_stores(&self) -> Vec<Arc<ObjectStore>>
pub fn active_stores(&self) -> Vec<Arc<ObjectStore>>
Get a list of all active object stores.
Calling this will also clean up any weak references to object stores that are no longer valid.
Sourcepub async fn get_store(
&self,
base_path: Url,
params: &ObjectStoreParams,
) -> Result<Arc<ObjectStore>>
pub async fn get_store( &self, base_path: Url, params: &ObjectStoreParams, ) -> Result<Arc<ObjectStore>>
Get an object store for a given base path and parameters.
If the object store is already in use, it will return a strong reference to the object store. If the object store is not in use, it will create a new object store and return a strong reference to it.
Source§impl ObjectStoreRegistry
impl ObjectStoreRegistry
Sourcepub fn insert(&self, scheme: &str, provider: Arc<dyn ObjectStoreProvider>)
pub fn insert(&self, scheme: &str, provider: Arc<dyn ObjectStoreProvider>)
Add a new object store provider to the registry. The provider will be used
in Self::get_store() when a URL is passed with a matching scheme.
Trait Implementations§
Source§impl Debug for ObjectStoreRegistry
impl Debug for ObjectStoreRegistry
Auto Trait Implementations§
impl !Freeze for ObjectStoreRegistry
impl RefUnwindSafe for ObjectStoreRegistry
impl Send for ObjectStoreRegistry
impl Sync for ObjectStoreRegistry
impl Unpin for ObjectStoreRegistry
impl UnwindSafe for ObjectStoreRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more