mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
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:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user