@@ -44,36 +44,40 @@ pub mod tables;
4444pub trait CatalogManager : Send + Sync {
4545 fn as_any ( & self ) -> & dyn Any ;
4646
47- /// Starts a catalog manager.
48- async fn start ( & self ) -> Result < ( ) > ;
49-
50- /// Registers a catalog to catalog manager, returns whether the catalog exist before.
51- async fn register_catalog ( self : Arc < Self > , name : String ) -> Result < bool > ;
47+ /// Register a local catalog.
48+ ///
49+ /// # Returns
50+ ///
51+ /// Whether the catalog is registered.
52+ fn register_local_catalog ( & self , name : & str ) -> Result < bool > ;
5253
53- /// Register a schema with catalog name and schema name. Retuens whether the
54- /// schema registered.
54+ /// Register a local schema.
55+ ///
56+ /// # Returns
57+ ///
58+ /// Whether the schema is registered.
5559 ///
5660 /// # Errors
5761 ///
5862 /// This method will/should fail if catalog not exist
59- async fn register_schema ( & self , request : RegisterSchemaRequest ) -> Result < bool > ;
63+ fn register_local_schema ( & self , request : RegisterSchemaRequest ) -> Result < bool > ;
6064
6165 /// Deregisters a database within given catalog/schema to catalog manager
62- async fn deregister_schema ( & self , request : DeregisterSchemaRequest ) -> Result < bool > ;
66+ fn deregister_local_schema ( & self , request : DeregisterSchemaRequest ) -> Result < bool > ;
6367
64- /// Registers a table within given catalog/schema to catalog manager,
65- /// returns whether the table registered.
68+ /// Registers a local table.
69+ ///
70+ /// # Returns
71+ ///
72+ /// Whether the table is registered.
6673 ///
6774 /// # Errors
6875 ///
6976 /// This method will/should fail if catalog or schema not exist
70- async fn register_table ( & self , request : RegisterTableRequest ) -> Result < bool > ;
77+ fn register_local_table ( & self , request : RegisterTableRequest ) -> Result < bool > ;
7178
7279 /// Deregisters a table within given catalog/schema to catalog manager
73- async fn deregister_table ( & self , request : DeregisterTableRequest ) -> Result < ( ) > ;
74-
75- /// Rename a table to [RenameTableRequest::new_table_name], returns whether the table is renamed.
76- async fn rename_table ( & self , request : RenameTableRequest ) -> Result < bool > ;
80+ fn deregister_local_table ( & self , request : DeregisterTableRequest ) -> Result < ( ) > ;
7781
7882 async fn catalog_names ( & self ) -> Result < Vec < String > > ;
7983
@@ -160,7 +164,7 @@ pub struct RegisterSchemaRequest {
160164 pub schema : String ,
161165}
162166
163- pub ( crate ) async fn handle_system_table_request < ' a , M : CatalogManager > (
167+ pub ( crate ) async fn handle_system_table_request < ' a , M : CatalogManager + ? Sized > (
164168 manager : & ' a M ,
165169 engine : TableEngineRef ,
166170 sys_table_requests : & ' a mut Vec < RegisterSystemTableRequest > ,
@@ -185,15 +189,13 @@ pub(crate) async fn handle_system_table_request<'a, M: CatalogManager>(
185189 table_name,
186190 ) ,
187191 } ) ?;
188- let _ = manager
189- . register_table ( RegisterTableRequest {
190- catalog : catalog_name. clone ( ) ,
191- schema : schema_name. clone ( ) ,
192- table_name : table_name. clone ( ) ,
193- table_id,
194- table : table. clone ( ) ,
195- } )
196- . await ?;
192+ manager. register_local_table ( RegisterTableRequest {
193+ catalog : catalog_name. clone ( ) ,
194+ schema : schema_name. clone ( ) ,
195+ table_name : table_name. clone ( ) ,
196+ table_id,
197+ table : table. clone ( ) ,
198+ } ) ?;
197199 info ! ( "Created and registered system table: {table_name}" ) ;
198200 table
199201 } ;
0 commit comments