feat(multitenancy): move users and tenants to global schema (#4781)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
Jagan
2024-06-05 18:50:40 +05:30
committed by GitHub
parent 76ec5e1e02
commit c5e28f2670
16 changed files with 278 additions and 86 deletions

View File

@ -112,13 +112,11 @@ pub trait StorageInterface:
+ OrganizationInterface
+ routing_algorithm::RoutingAlgorithmInterface
+ gsm::GsmInterface
+ user::UserInterface
+ user_role::UserRoleInterface
+ authorization::AuthorizationInterface
+ user::sample_data::BatchSampleDataInterface
+ health_check::HealthCheckDbInterface
+ role::RoleInterface
+ user_key_store::UserKeyStoreInterface
+ authentication::AuthenticationInterface
+ 'static
{
@ -127,6 +125,22 @@ pub trait StorageInterface:
fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)>;
}
#[async_trait::async_trait]
pub trait GlobalStorageInterface:
Send
+ Sync
+ dyn_clone::DynClone
+ user::UserInterface
+ user_key_store::UserKeyStoreInterface
+ 'static
{
}
pub trait CommonStorageInterface: StorageInterface + GlobalStorageInterface {
fn get_storage_interface(&self) -> Box<dyn StorageInterface>;
fn get_global_storage_interface(&self) -> Box<dyn GlobalStorageInterface>;
}
pub trait MasterKeyInterface {
fn get_master_key(&self) -> &[u8];
}
@ -158,6 +172,9 @@ impl StorageInterface for Store {
}
}
#[async_trait::async_trait]
impl GlobalStorageInterface for Store {}
#[async_trait::async_trait]
impl StorageInterface for MockDb {
fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface> {
@ -169,6 +186,27 @@ impl StorageInterface for MockDb {
}
}
#[async_trait::async_trait]
impl GlobalStorageInterface for MockDb {}
impl CommonStorageInterface for MockDb {
fn get_global_storage_interface(&self) -> Box<dyn GlobalStorageInterface> {
Box::new(self.clone())
}
fn get_storage_interface(&self) -> Box<dyn StorageInterface> {
Box::new(self.clone())
}
}
impl CommonStorageInterface for Store {
fn get_global_storage_interface(&self) -> Box<dyn GlobalStorageInterface> {
Box::new(self.clone())
}
fn get_storage_interface(&self) -> Box<dyn StorageInterface> {
Box::new(self.clone())
}
}
pub trait RequestIdStore {
fn add_request_id(&mut self, _request_id: String) {}
fn get_request_id(&self) -> Option<String> {
@ -205,6 +243,7 @@ where
}
dyn_clone::clone_trait_object!(StorageInterface);
dyn_clone::clone_trait_object!(GlobalStorageInterface);
impl RequestIdStore for KafkaStore {
fn add_request_id(&mut self, request_id: String) {