feat: Soft kill kv (#4582)

Co-authored-by: Akshay S <akshay.s@Akshay-Subramanian-D66TQ6D97K.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
akshay-97
2024-05-20 12:47:05 +05:30
committed by GitHub
parent 5e84855496
commit 3fa59d4bac
32 changed files with 462 additions and 118 deletions

View File

@ -151,6 +151,7 @@ pub struct KVRouterStore<T: DatabaseStore> {
drainer_num_partitions: u8,
ttl_for_kv: u32,
pub request_id: Option<String>,
soft_kill_mode: bool,
}
#[async_trait::async_trait]
@ -159,14 +160,16 @@ where
RouterStore<T>: DatabaseStore,
T: DatabaseStore,
{
type Config = (RouterStore<T>, String, u8, u32);
type Config = (RouterStore<T>, String, u8, u32, Option<bool>);
async fn new(config: Self::Config, _test_transaction: bool) -> StorageResult<Self> {
let (router_store, drainer_stream_name, drainer_num_partitions, ttl_for_kv) = config;
let (router_store, drainer_stream_name, drainer_num_partitions, ttl_for_kv, soft_kill_mode) =
config;
Ok(Self::from_store(
router_store,
drainer_stream_name,
drainer_num_partitions,
ttl_for_kv,
soft_kill_mode,
))
}
fn get_master_pool(&self) -> &PgPool {
@ -191,6 +194,7 @@ impl<T: DatabaseStore> KVRouterStore<T> {
drainer_stream_name: String,
drainer_num_partitions: u8,
ttl_for_kv: u32,
soft_kill: Option<bool>,
) -> Self {
let request_id = store.request_id.clone();
@ -200,6 +204,7 @@ impl<T: DatabaseStore> KVRouterStore<T> {
drainer_num_partitions,
ttl_for_kv,
request_id,
soft_kill_mode: soft_kill.unwrap_or(false),
}
}