Skip to content

Commit 3ec71ef

Browse files
authored
refactor(schema-api): extract TableApi and IndexApi traits (#18652)
Extract table and index operations from SchemaApi into separate traits to improve modularity and separation of concerns. This change organizes the codebase into focused, specialized traits for better maintainability and clearer API boundaries. Key changes: - Create TableApi trait in src/meta/api/src/table_api.rs with all table lifecycle operations (create, drop, rename, truncate, etc.) - Create IndexApi trait in src/meta/api/src/index_api.rs with all index management operations (create, drop, list, gc operations) - Move corresponding implementations from schema_api.rs to the new trait files while preserving all existing functionality - Update imports across the codebase to use the new traits - Add required type parameters for generic method calls where the Rust compiler cannot infer types automatically - Make internal utility functions public where needed by the new trait implementations This refactoring maintains full API compatibility while creating a cleaner, more organized code structure that will facilitate future development and testing.
1 parent 0826e0f commit 3ec71ef

File tree

9 files changed

+2195
-1999
lines changed

9 files changed

+2195
-1999
lines changed

src/meta/api/src/index_api.rs

Lines changed: 505 additions & 0 deletions
Large diffs are not rendered by default.

src/meta/api/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mod data_mask_api;
2222
mod data_mask_api_impl;
2323
mod database_api;
2424
pub mod database_util;
25+
pub mod index_api;
2526
pub mod kv_app_error;
2627
pub mod kv_pb_api;
2728
pub mod kv_pb_crud_api;
@@ -32,6 +33,7 @@ pub mod reply;
3233
mod schema_api;
3334
mod schema_api_test_suite;
3435
mod sequence_api;
36+
pub mod table_api;
3537
pub(crate) mod testing;
3638
pub mod txn_backoff;
3739
pub mod util;
@@ -45,10 +47,12 @@ pub(crate) mod sequence_nextval_impl;
4547

4648
pub use data_mask_api::DatamaskApi;
4749
pub use database_api::DatabaseApi;
50+
pub use index_api::IndexApi;
4851
pub use row_access_policy_api::RowAccessPolicyApi;
4952
pub use schema_api::SchemaApi;
5053
pub use schema_api_test_suite::SchemaApiTestSuite;
5154
pub use sequence_api::SequenceApi;
55+
pub use table_api::TableApi;
5256
pub use util::assert_table_exist;
5357
pub use util::db_has_to_exist;
5458
pub use util::deserialize_struct;

src/meta/api/src/schema_api.rs

Lines changed: 11 additions & 1997 deletions
Large diffs are not rendered by default.

src/meta/api/src/schema_api_test_suite.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ use crate::testing::get_kv_data;
156156
use crate::testing::get_kv_u64_data;
157157
use crate::util::IdempotentKVTxnSender;
158158
use crate::DatamaskApi;
159+
use crate::IndexApi;
159160
use crate::RowAccessPolicyApi;
160161
use crate::SchemaApi;
161162
use crate::SequenceApi;
163+
use crate::TableApi;
162164
use crate::DEFAULT_MGET_SIZE;
163165

164166
/// Test suite of `SchemaApi`.

0 commit comments

Comments
 (0)