-
Notifications
You must be signed in to change notification settings - Fork 277
Add catalog builder trait #1261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
6d34ce3
6969f68
8f59621
56b3f8f
f404d23
d494f39
bf0576e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,18 @@ pub trait Catalog: Debug + Sync + Send { | |
async fn update_table(&self, commit: TableCommit) -> Result<Table>; | ||
} | ||
|
||
/// Common interface for all catalog builders. | ||
pub trait CatalogBuilder: Default + Debug + Send + Sync { | ||
/// The catalog type that this builder creates. | ||
type C: Catalog; | ||
/// Create a new catalog instance. | ||
fn load( | ||
self, | ||
name: impl Into<String>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still perfer to use this generic given we don't need to worry about object safety things 😄 |
||
props: HashMap<String, String>, | ||
) -> impl Future<Output = Result<Self::C>> + Send; | ||
} | ||
|
||
/// NamespaceIdent represents the identifier of a namespace in the catalog. | ||
/// | ||
/// The namespace identifier is a list of strings, where each string is a | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about simply using
async fn
? It's not a big thing for us to place withSend
I guess.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need
Send
, otherwise this line can't be compiled.