async fn create_from_config(
        config: &ObjectStoreConfig,
    ) -> Result<Arc<dyn ObjectStore>, ObjectStoreError> {
        tracing::trace!("Initializing object store with configuration {config:?}");
        match &config.mode {
            ObjectStoreMode::GCS { bucket_base_url } => {
                let store = StoreWithRetries::try_new(config.max_retries, || {
                    GoogleCloudStore::new(
                        GoogleCloudStoreAuthMode::Authenticated,
                        bucket_base_url.clone(),
                    )
                })
                .await?;
                Self::wrap_mirroring(store, config.local_mirror_path.as_deref()).await
            }
            ObjectStoreMode::GCSWithCredentialFile {
                bucket_base_url,
                gcs_credential_file_path,
            } => {
                let store = StoreWithRetries::try_new(config.max_retries, || {
                    GoogleCloudStore::new(
                        GoogleCloudStoreAuthMode::AuthenticatedWithCredentialFile(
                            gcs_credential_file_path.clone(),
                        ),
                        bucket_base_url.clone(),
                    )
                })
                .await?;
                Self::wrap_mirroring(store, config.local_mirror_path.as_deref()).await
            }
            ObjectStoreMode::GCSAnonymousReadOnly { bucket_base_url } => {
                let store = StoreWithRetries::try_new(config.max_retries, || {
                    GoogleCloudStore::new(
                        GoogleCloudStoreAuthMode::Anonymous,
                        bucket_base_url.clone(),
                    )
                })
                .await?;
                Self::wrap_mirroring(store, config.local_mirror_path.as_deref()).await
            }

            ObjectStoreMode::S3WithCredentialFile {
                bucket_base_url,
                s3_credential_file_path,
                endpoint,
                region,
            } => {
                let store = StoreWithRetries::try_new(config.max_retries, || {
                    S3Store::new(
                        S3StoreAuthMode::AuthenticatedWithCredentialFile(
                            s3_credential_file_path.clone(),
                        ),
                        bucket_base_url.clone(),
                        endpoint.clone(),
                        region.clone(),
                    )
                })
                .await?;
                Self::wrap_mirroring(store, config.local_mirror_path.as_deref()).await
            }
            ObjectStoreMode::S3AnonymousReadOnly {
                bucket_base_url,
                endpoint,
                region,
            } => {
                let store = StoreWithRetries::try_new(config.max_retries, || {
                    S3Store::new(
                        S3StoreAuthMode::Anonymous,
                        bucket_base_url.clone(),
                        endpoint.clone(),
                        region.clone(),
                    )
                })
                .await?;
                Self::wrap_mirroring(store, config.local_mirror_path.as_deref()).await
            }

            ObjectStoreMode::FileBacked {
                file_backed_base_path,
            } => {
                let store = StoreWithRetries::try_new(config.max_retries, || {
                    FileBackedObjectStore::new(file_backed_base_path.clone())
                })
                .await?;

                if let Some(mirror_path) = &config.local_mirror_path {
                    tracing::warn!(
                        "Mirroring doesn't make sense with file-backed object store; ignoring mirror path `{}`",
                        mirror_path.display()
                    );
                }
                Ok(Arc::new(store))
            }
        }
    }
Creates an [`ObjectStore`] based on the provided `config`.

# Errors

Returns an error if store initialization fails (e.g., because of incorrect configuration).
core/lib/object_store/src/factory.rs