diff --git a/crates/iceberg/src/catalog/mod.rs b/crates/iceberg/src/catalog/mod.rs index 6a1572a4a..cf0340db3 100644 --- a/crates/iceberg/src/catalog/mod.rs +++ b/crates/iceberg/src/catalog/mod.rs @@ -19,6 +19,7 @@ use std::collections::HashMap; use std::fmt::{Debug, Display}; +use std::future::Future; use std::mem::take; use std::ops::Deref; @@ -96,6 +97,22 @@ pub trait Catalog: Debug + Sync + Send { async fn update_table(&self, commit: TableCommit) -> Result; } +/// Common interface for all catalog builders. +pub trait CatalogBuilder: Default + Debug + Send + Sync { + /// The catalog type that this builder creates. + type C: Catalog; + /// Configure name of the catalog. + fn name(self, name: impl Into) -> Self; + /// Configure uri of the catalog. + fn uri(self, uri: impl Into) -> Self; + /// Configure warehouse location of the catalog. + fn warehouse(self, warehouse: impl Into) -> Self; + /// Configure properties of the catalog. + fn with_prop(self, key: impl Into, value: impl Into) -> Self; + /// Create the catalog + fn build(self) -> impl Future>; +} + /// NamespaceIdent represents the identifier of a namespace in the catalog. /// /// The namespace identifier is a list of strings, where each string is a diff --git a/crates/iceberg/src/lib.rs b/crates/iceberg/src/lib.rs index 556ff3e02..f94b2b113 100644 --- a/crates/iceberg/src/lib.rs +++ b/crates/iceberg/src/lib.rs @@ -62,10 +62,7 @@ pub use error::{Error, ErrorKind, Result}; mod catalog; -pub use catalog::{ - Catalog, Namespace, NamespaceIdent, TableCommit, TableCreation, TableIdent, TableRequirement, - TableUpdate, ViewCreation, -}; +pub use catalog::*; pub mod table;