refactor(storage_impl): Integrate the composite store from external crate (#1921)

This commit is contained in:
Sampras Lopes
2023-08-14 18:46:31 +05:30
committed by GitHub
parent b1e4e3883d
commit 9f199d9ab8
44 changed files with 490 additions and 445 deletions

View File

@ -1,4 +1,6 @@
pub(crate) trait KvStorePartition {
use std::sync::Arc;
pub trait KvStorePartition {
fn partition_number(key: PartitionKey<'_>, num_partitions: u8) -> u32 {
crc32fast::hash(key.to_string().as_bytes()) % u32::from(num_partitions)
}
@ -9,7 +11,7 @@ pub(crate) trait KvStorePartition {
}
#[allow(unused)]
pub(crate) enum PartitionKey<'a> {
pub enum PartitionKey<'a> {
MerchantIdPaymentId {
merchant_id: &'a str,
payment_id: &'a str,
@ -26,3 +28,12 @@ impl<'a> std::fmt::Display for PartitionKey<'a> {
}
}
}
pub trait RedisConnInterface {
fn get_redis_conn(
&self,
) -> error_stack::Result<
Arc<redis_interface::RedisConnectionPool>,
redis_interface::errors::RedisError,
>;
}