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,8 +1,10 @@
use error_stack::IntoReport;
#[cfg(feature = "accounts_cache")]
use storage_impl::redis::cache::CacheKind;
#[cfg(feature = "accounts_cache")]
use storage_impl::redis::cache::ACCOUNTS_CACHE;
use super::{MockDb, Store};
#[cfg(feature = "accounts_cache")]
use crate::cache::{self, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
@ -104,7 +106,7 @@ impl ApiKeyInterface for Store {
super::cache::publish_and_redact(
self,
cache::CacheKind::Accounts(api_key.hashed_api_key.into_inner().into()),
CacheKind::Accounts(api_key.hashed_api_key.into_inner().into()),
update_call,
)
.await
@ -147,7 +149,7 @@ impl ApiKeyInterface for Store {
super::cache::publish_and_redact(
self,
cache::CacheKind::Accounts(api_key.hashed_api_key.into_inner().into()),
CacheKind::Accounts(api_key.hashed_api_key.into_inner().into()),
delete_call,
)
.await
@ -373,12 +375,15 @@ impl ApiKeyInterface for MockDb {
#[cfg(test)]
mod tests {
use storage_impl::redis::{
cache::{CacheKind, ACCOUNTS_CACHE},
kv_store::RedisConnInterface,
pub_sub::PubSubInterface,
};
use time::macros::datetime;
use crate::{
cache::{CacheKind, ACCOUNTS_CACHE},
db::{api_keys::ApiKeyInterface, cache, MockDb},
services::{PubSubInterface, RedisConnInterface},
types::storage,
};