INNER CODE UNIT · Rust
build_object_store_from_opts
splitgraph/seafowl · object_store_factory/src/lib.rs:136
pub async fn build_object_store_from_opts(
url: &Url,
options: HashMap<String, String>,
) -> Result<Box<dyn ObjectStore>, object_store::Error> {
let (scheme, _) = ObjectStoreScheme::parse(url).unwrap();
match scheme {
// `parse_url_opts` will swallow the URL path for memory/local FS stores
ObjectStoreScheme::Memory => {
let mut store: Box<dyn ObjectStore> = Box::new(InMemory::new());
if !url.path().is_empty() {
store = Box::new(PrefixStore::new(store, url.path()));
}
Ok(store)
}
ObjectStoreScheme::Local => {
let store = LocalConfig {