1pub mod client;
7pub mod errors;
8pub mod execute;
9pub mod logstore;
10pub mod storage;
11use deltalake_core::logstore::{logstore_factories, LogStore, LogStoreFactory};
12use deltalake_core::logstore::{object_store_factories, ObjectStoreRef, StorageConfig};
13use deltalake_core::DeltaResult;
14pub use execute::LakeFSCustomExecuteHandler;
15use logstore::lakefs_logstore;
16use std::sync::Arc;
17use storage::LakeFSObjectStoreFactory;
18use storage::S3StorageOptionsConversion;
19use tracing::debug;
20use url::Url;
21
22#[derive(Clone, Debug, Default)]
23pub struct LakeFSLogStoreFactory {}
24
25impl S3StorageOptionsConversion for LakeFSLogStoreFactory {}
26
27impl LogStoreFactory for LakeFSLogStoreFactory {
28 fn with_options(
29 &self,
30 prefixed_store: ObjectStoreRef,
31 root_store: ObjectStoreRef,
32 location: &Url,
33 config: &StorageConfig,
34 ) -> DeltaResult<Arc<dyn LogStore>> {
35 let options = StorageConfig::parse_options(self.with_env_s3(&config.raw.clone()))?;
36 debug!("LakeFSLogStoreFactory has been asked to create a LogStore");
37 lakefs_logstore(prefixed_store, root_store, location, &options)
38 }
39}
40
41pub fn register_handlers(_additional_prefixes: Option<Url>) {
43 let object_stores = Arc::new(LakeFSObjectStoreFactory::default());
44 let log_stores = Arc::new(LakeFSLogStoreFactory::default());
45 let scheme = "lakefs";
46 let url = Url::parse(&format!("{scheme}://")).unwrap();
47 object_store_factories().insert(url.clone(), object_stores.clone());
48 logstore_factories().insert(url.clone(), log_stores.clone());
49}