Skip to content

Commit e8371de

Browse files
Add catalog builder trait (#1261)
## Which issue does this PR close? - Closes #1254 . ## What changes are included in this PR? Add `CatalogBuilder` trait. ## Are these changes tested? No, empty trait def.
1 parent b5b8aa8 commit e8371de

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

crates/iceberg/src/catalog/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
use std::collections::HashMap;
2121
use std::fmt::{Debug, Display};
22+
use std::future::Future;
2223
use std::mem::take;
2324
use std::ops::Deref;
2425

@@ -96,6 +97,18 @@ pub trait Catalog: Debug + Sync + Send {
9697
async fn update_table(&self, commit: TableCommit) -> Result<Table>;
9798
}
9899

100+
/// Common interface for all catalog builders.
101+
pub trait CatalogBuilder: Default + Debug + Send + Sync {
102+
/// The catalog type that this builder creates.
103+
type C: Catalog;
104+
/// Create a new catalog instance.
105+
fn load(
106+
self,
107+
name: impl Into<String>,
108+
props: HashMap<String, String>,
109+
) -> impl Future<Output = Result<Self::C>> + Send;
110+
}
111+
99112
/// NamespaceIdent represents the identifier of a namespace in the catalog.
100113
///
101114
/// The namespace identifier is a list of strings, where each string is a

crates/iceberg/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ pub use error::{Error, ErrorKind, Result};
6464

6565
mod catalog;
6666

67-
pub use catalog::{
68-
Catalog, Namespace, NamespaceIdent, TableCommit, TableCreation, TableIdent, TableRequirement,
69-
TableUpdate, ViewCreation,
70-
};
67+
pub use catalog::*;
7168

7269
pub mod table;
7370

0 commit comments

Comments
 (0)