id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
hyperswitch_fn_storage_impl_1170834767808638385 | clm | function | // hyperswitch/crates/storage_impl/src/utils.rs
pub async fn pg_connection_write<T: DatabaseStore>(
store: &T,
) -> error_stack::Result<
PooledConnection<'_, async_bb8_diesel::ConnectionManager<PgConnection>>,
StorageError,
> {
// Since all writes should happen to master DB only choose master DB.
let pool = store.get_master_pool();
pool.get()
.await
.change_context(StorageError::DatabaseConnectionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "pg_connection_write",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6095676447839038669 | clm | function | // hyperswitch/crates/storage_impl/src/utils.rs
pub async fn pg_accounts_connection_read<T: DatabaseStore>(
store: &T,
) -> error_stack::Result<
PooledConnection<'_, async_bb8_diesel::ConnectionManager<PgConnection>>,
StorageError,
> {
// If only OLAP is enabled get replica pool.
#[cfg(all(feature = "olap", not(feature = "oltp")))]
let pool = store.get_accounts_replica_pool();
// If either one of these are true we need to get master pool.
// 1. Only OLTP is enabled.
// 2. Both OLAP and OLTP is enabled.
// 3. Both OLAP and OLTP is disabled.
#[cfg(any(
all(not(feature = "olap"), feature = "oltp"),
all(feature = "olap", feature = "oltp"),
all(not(feature = "olap"), not(feature = "oltp"))
))]
let pool = store.get_accounts_master_pool();
pool.get()
.await
.change_context(StorageError::DatabaseConnectionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "pg_accounts_connection_read",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7240089674826133474 | clm | function | // hyperswitch/crates/storage_impl/src/utils.rs
pub async fn pg_accounts_connection_write<T: DatabaseStore>(
store: &T,
) -> error_stack::Result<
PooledConnection<'_, async_bb8_diesel::ConnectionManager<PgConnection>>,
StorageError,
> {
// Since all writes should happen to master DB only choose master DB.
let pool = store.get_accounts_master_pool();
pool.get()
.await
.change_context(StorageError::DatabaseConnectionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "pg_accounts_connection_write",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_3513833507808883485 | clm | function | // hyperswitch/crates/storage_impl/src/utils.rs
pub async fn try_redis_get_else_try_database_get<F, RFut, DFut, T>(
redis_fut: RFut,
database_call_closure: F,
) -> error_stack::Result<T, StorageError>
where
F: FnOnce() -> DFut,
RFut: futures::Future<Output = error_stack::Result<T, redis_interface::errors::RedisError>>,
DFut: futures::Future<Output = error_stack::Result<T, StorageError>>,
{
let redis_output = redis_fut.await;
match redis_output {
Ok(output) => Ok(output),
Err(redis_error) => match redis_error.current_context() {
redis_interface::errors::RedisError::NotFound => {
metrics::KV_MISS.add(1, &[]);
database_call_closure().await
}
// Keeping the key empty here since the error would never go here.
_ => Err(redis_error.to_redis_failed_response("")),
},
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_redis_get_else_try_database_get",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8153097758232445168 | clm | function | // hyperswitch/crates/storage_impl/src/utils.rs
fn union_vec<T>(mut kv_rows: Vec<T>, sql_rows: Vec<T>) -> Vec<T>
where
T: UniqueConstraints,
{
let mut kv_unique_keys = HashSet::new();
kv_rows.iter().for_each(|v| {
kv_unique_keys.insert(v.unique_constraints().concat());
});
sql_rows.into_iter().for_each(|v| {
let unique_key = v.unique_constraints().concat();
if !kv_unique_keys.contains(&unique_key) {
kv_rows.push(v);
}
});
kv_rows
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "union_vec",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7882206472638495467 | clm | function | // hyperswitch/crates/storage_impl/src/utils.rs
pub async fn find_all_combined_kv_database<F, RFut, DFut, T>(
redis_fut: RFut,
database_call: F,
limit: Option<i64>,
) -> error_stack::Result<Vec<T>, StorageError>
where
T: UniqueConstraints,
F: FnOnce() -> DFut,
RFut:
futures::Future<Output = error_stack::Result<Vec<T>, redis_interface::errors::RedisError>>,
DFut: futures::Future<Output = error_stack::Result<Vec<T>, StorageError>>,
{
let trunc = |v: &mut Vec<_>| {
if let Some(l) = limit.and_then(|v| TryInto::try_into(v).ok()) {
v.truncate(l);
}
};
let limit_satisfies = |len: usize, limit: i64| {
TryInto::try_into(limit)
.ok()
.is_none_or(|val: usize| len >= val)
};
let redis_output = redis_fut.await;
match (redis_output, limit) {
(Ok(mut kv_rows), Some(lim)) if limit_satisfies(kv_rows.len(), lim) => {
trunc(&mut kv_rows);
Ok(kv_rows)
}
(Ok(kv_rows), _) => database_call().await.map(|db_rows| {
let mut res = union_vec(kv_rows, db_rows);
trunc(&mut res);
res
}),
(Err(redis_error), _) => match redis_error.current_context() {
redis_interface::errors::RedisError::NotFound => {
metrics::KV_MISS.add(1, &[]);
database_call().await
}
// Keeping the key empty here since the error would never go here.
_ => Err(redis_error.to_redis_failed_response("")),
},
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_all_combined_kv_database",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_5200686048001973554 | clm | function | // hyperswitch/crates/storage_impl/src/redis.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CacheStore")
.field("redis_conn", &"Redis conn doesn't implement debug")
.finish()
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "fmt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6625319913744298493 | clm | function | // hyperswitch/crates/storage_impl/src/redis.rs
pub async fn new(
conf: &redis_interface::RedisSettings,
) -> error_stack::Result<Self, redis_interface::errors::RedisError> {
Ok(Self {
redis_conn: Arc::new(redis_interface::RedisConnectionPool::new(conf).await?),
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4639491299611225061 | clm | function | // hyperswitch/crates/storage_impl/src/redis.rs
pub fn set_error_callback(&self, callback: tokio::sync::oneshot::Sender<()>) {
let redis_clone = self.redis_conn.clone();
let _task_handle = tokio::spawn(
async move {
redis_clone.on_error(callback).await;
}
.in_current_span(),
);
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "set_error_callback",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7229277095921864311 | clm | function | // hyperswitch/crates/storage_impl/src/redis.rs
fn get_redis_conn(
&self,
) -> error_stack::Result<
Arc<redis_interface::RedisConnectionPool>,
redis_interface::errors::RedisError,
> {
if self
.redis_conn
.is_redis_available
.load(atomic::Ordering::SeqCst)
{
Ok(self.redis_conn.clone())
} else {
Err(redis_interface::errors::RedisError::RedisConnectionError.into())
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_redis_conn",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-5671145574457604458 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
async fn new(
config: (Database, Database),
tenant_config: &dyn TenantConfig,
test_transaction: bool,
) -> StorageResult<Self> {
let (master_config, replica_config) = config;
let master_pool =
diesel_make_pg_pool(&master_config, tenant_config.get_schema(), test_transaction)
.await
.attach_printable("failed to create master pool")?;
let accounts_master_pool = diesel_make_pg_pool(
&master_config,
tenant_config.get_accounts_schema(),
test_transaction,
)
.await
.attach_printable("failed to create accounts master pool")?;
let replica_pool = diesel_make_pg_pool(
&replica_config,
tenant_config.get_schema(),
test_transaction,
)
.await
.attach_printable("failed to create replica pool")?;
let accounts_replica_pool = diesel_make_pg_pool(
&replica_config,
tenant_config.get_accounts_schema(),
test_transaction,
)
.await
.attach_printable("failed to create accounts pool")?;
Ok(Self {
master_pool,
replica_pool,
accounts_master_pool,
accounts_replica_pool,
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8022360960132249042 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
fn get_master_pool(&self) -> &PgPool {
&self.master_pool
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_master_pool",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8236855530056836249 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
fn get_replica_pool(&self) -> &PgPool {
&self.replica_pool
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_replica_pool",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1347435366876182224 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
fn get_accounts_master_pool(&self) -> &PgPool {
&self.accounts_master_pool
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_accounts_master_pool",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8759367904852298838 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
fn get_accounts_replica_pool(&self) -> &PgPool {
&self.accounts_replica_pool
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_accounts_replica_pool",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1897001186066760228 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
pub async fn diesel_make_pg_pool(
database: &Database,
schema: &str,
test_transaction: bool,
) -> StorageResult<PgPool> {
let database_url = database.get_database_url(schema);
let manager = async_bb8_diesel::ConnectionManager::<PgConnection>::new(database_url);
let mut pool = bb8::Pool::builder()
.max_size(database.pool_size)
.min_idle(database.min_idle)
.queue_strategy(database.queue_strategy.into())
.connection_timeout(std::time::Duration::from_secs(database.connection_timeout))
.max_lifetime(database.max_lifetime.map(std::time::Duration::from_secs));
if test_transaction {
pool = pool.connection_customizer(Box::new(TestTransaction));
}
pool.build(manager)
.await
.change_context(StorageError::InitializationError)
.attach_printable("Failed to create PostgreSQL connection pool")
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "diesel_make_pg_pool",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1355206388291008048 | clm | function | // hyperswitch/crates/storage_impl/src/database/store.rs
async fn on_acquire(&self, conn: &mut PgPooledConn) -> Result<(), ConnectionError> {
use diesel::Connection;
conn.run(|conn| {
conn.begin_test_transaction().unwrap();
Ok(())
})
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "on_acquire",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3562040370322417775 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn insert_payment_attempt(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &MerchantKeyStore,
payment_attempt: PaymentAttempt,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let decided_storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Insert,
))
.await;
match decided_storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.insert_payment_attempt(
key_manager_state,
merchant_key_store,
payment_attempt,
decided_storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::GlobalPaymentId {
id: &payment_attempt.payment_id,
};
let key_str = key.to_string();
let field = format!(
"{}_{}",
label::CLUSTER_LABEL,
payment_attempt.id.get_string_repr()
);
let diesel_payment_attempt_new = payment_attempt
.clone()
.construct_new()
.await
.change_context(errors::StorageError::EncryptionError)?;
let diesel_payment_attempt_for_redis: DieselPaymentAttempt =
Conversion::convert(payment_attempt.clone())
.await
.change_context(errors::StorageError::EncryptionError)?;
let redis_entry = kv::TypedSql {
op: kv::DBOperation::Insert {
insertable: Box::new(kv::Insertable::PaymentAttempt(Box::new(
diesel_payment_attempt_new.clone(),
))),
},
};
let reverse_lookup_attempt_id = ReverseLookupNew {
lookup_id: label::get_global_id_label(&payment_attempt.id),
pk_id: key_str.clone(),
sk_id: field.clone(),
source: "payment_attempt".to_string(),
updated_by: decided_storage_scheme.to_string(),
};
self.insert_reverse_lookup(reverse_lookup_attempt_id, decided_storage_scheme)
.await?;
if let Some(ref conn_txn_id_val) = payment_attempt.connector_payment_id {
let reverse_lookup_conn_txn_id = ReverseLookupNew {
lookup_id: label::get_profile_id_connector_transaction_label(
payment_attempt.profile_id.get_string_repr(),
conn_txn_id_val,
),
pk_id: key_str.clone(),
sk_id: field.clone(),
source: "payment_attempt".to_string(),
updated_by: decided_storage_scheme.to_string(),
};
self.insert_reverse_lookup(reverse_lookup_conn_txn_id, decided_storage_scheme)
.await?;
}
match Box::pin(kv_wrapper::<DieselPaymentAttempt, _, _>(
self,
KvOperation::HSetNx(&field, &diesel_payment_attempt_for_redis, redis_entry),
key,
))
.await
.map_err(|err| err.to_redis_failed_response(&key_str))?
.try_into_hsetnx()
{
Ok(HsetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue {
entity: "payment_attempt",
key: Some(payment_attempt.id.get_string_repr().to_owned()),
}
.into()),
Ok(HsetnxReply::KeySet) => Ok(payment_attempt),
Err(error) => Err(error.change_context(errors::StorageError::KVError)),
}
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payment_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-606690943743832275 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn update_payment_attempt_with_attempt_id(
&self,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let key = PartitionKey::MerchantIdPaymentId {
merchant_id: &this.merchant_id,
payment_id: &this.payment_id,
};
let field = format!("pa_{}", this.attempt_id);
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Update(key.clone(), &field, Some(&this.updated_by)),
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.update_payment_attempt_with_attempt_id(this, payment_attempt, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => {
let key_str = key.to_string();
let old_connector_transaction_id = &this.get_connector_payment_id();
let old_preprocessing_id = &this.preprocessing_step_id;
let updated_attempt = PaymentAttempt::from_storage_model(
payment_attempt
.clone()
.to_storage_model()
.apply_changeset(this.clone().to_storage_model()),
);
// Check for database presence as well Maybe use a read replica here ?
let redis_value = serde_json::to_string(&updated_attempt)
.change_context(errors::StorageError::KVError)?;
let redis_entry = kv::TypedSql {
op: kv::DBOperation::Update {
updatable: Box::new(kv::Updateable::PaymentAttemptUpdate(Box::new(
kv::PaymentAttemptUpdateMems {
orig: this.clone().to_storage_model(),
update_data: payment_attempt.to_storage_model(),
},
))),
},
};
match (
old_connector_transaction_id,
&updated_attempt.get_connector_payment_id(),
) {
(None, Some(connector_transaction_id)) => {
add_connector_txn_id_to_reverse_lookup(
self,
key_str.as_str(),
&this.merchant_id,
updated_attempt.attempt_id.as_str(),
connector_transaction_id,
storage_scheme,
)
.await?;
}
(Some(old_connector_transaction_id), Some(connector_transaction_id)) => {
if old_connector_transaction_id.ne(connector_transaction_id) {
add_connector_txn_id_to_reverse_lookup(
self,
key_str.as_str(),
&this.merchant_id,
updated_attempt.attempt_id.as_str(),
connector_transaction_id,
storage_scheme,
)
.await?;
}
}
(_, _) => {}
}
match (old_preprocessing_id, &updated_attempt.preprocessing_step_id) {
(None, Some(preprocessing_id)) => {
add_preprocessing_id_to_reverse_lookup(
self,
key_str.as_str(),
&this.merchant_id,
updated_attempt.attempt_id.as_str(),
preprocessing_id.as_str(),
storage_scheme,
)
.await?;
}
(Some(old_preprocessing_id), Some(preprocessing_id)) => {
if old_preprocessing_id.ne(preprocessing_id) {
add_preprocessing_id_to_reverse_lookup(
self,
key_str.as_str(),
&this.merchant_id,
updated_attempt.attempt_id.as_str(),
preprocessing_id.as_str(),
storage_scheme,
)
.await?;
}
}
(_, _) => {}
}
Box::pin(kv_wrapper::<(), _, _>(
self,
KvOperation::Hset::<DieselPaymentAttempt>((&field, redis_value), redis_entry),
key,
))
.await
.change_context(errors::StorageError::KVError)?
.try_into_hset()
.change_context(errors::StorageError::KVError)?;
Ok(updated_attempt)
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payment_attempt_with_attempt_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3485100789687353502 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn update_payment_attempt(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &MerchantKeyStore,
this: PaymentAttempt,
payment_attempt_update: PaymentAttemptUpdate,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let payment_attempt = Conversion::convert(this.clone())
.await
.change_context(errors::StorageError::DecryptionError)?;
let key = PartitionKey::GlobalPaymentId {
id: &this.payment_id,
};
let field = format!("{}_{}", label::CLUSTER_LABEL, this.id.get_string_repr());
let conn = pg_connection_write(self).await?;
let payment_attempt_internal =
diesel_models::PaymentAttemptUpdateInternal::from(payment_attempt_update);
let updated_payment_attempt = payment_attempt_internal
.clone()
.apply_changeset(payment_attempt.clone());
let updated_by = updated_payment_attempt.updated_by.to_owned();
let updated_payment_attempt_with_id = payment_attempt
.clone()
.update_with_attempt_id(&conn, payment_attempt_internal.clone());
Box::pin(self.update_resource(
key_manager_state,
merchant_key_store,
storage_scheme,
updated_payment_attempt_with_id,
updated_payment_attempt,
UpdateResourceParams {
updateable: kv::Updateable::PaymentAttemptUpdate(Box::new(
kv::PaymentAttemptUpdateMems {
orig: payment_attempt,
update_data: payment_attempt_internal,
},
)),
operation: Op::Update(key.clone(), &field, Some(updated_by.as_str())),
},
))
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payment_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_3218133646208965237 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self,
connector_transaction_id: &ConnectorTransactionId,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
connector_transaction_id,
payment_id,
merchant_id,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
// We assume that PaymentAttempt <=> PaymentIntent is a one-to-one relation for now
let lookup_id = format!(
"pa_conn_trans_{}_{}",
merchant_id.get_string_repr(),
connector_transaction_id.get_id()
);
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
.find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
connector_transaction_id,
payment_id,
merchant_id,
storage_scheme,
)
.await
);
let key = PartitionKey::CombinationKey {
combination: &lookup.pk_id,
};
Box::pin(try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(self, KvOperation::<DieselPaymentAttempt>::HGet(&lookup.sk_id), key)).await?.try_into_hget()
},
|| async {self.router_store.find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(connector_transaction_id, payment_id, merchant_id, storage_scheme).await},
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7716145507732903485 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
.find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
payment_id,
merchant_id,
storage_scheme,
)
};
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
merchant_id,
payment_id,
};
let pattern = "pa_*";
let redis_fut = async {
let kv_result = Box::pin(kv_wrapper::<PaymentAttempt, _, _>(
self,
KvOperation::<DieselPaymentAttempt>::Scan(pattern),
key,
))
.await?
.try_into_scan();
kv_result.and_then(|mut payment_attempts| {
payment_attempts.sort_by(|a, b| b.modified_at.cmp(&a.modified_at));
payment_attempts
.iter()
.find(|&pa| pa.status == api_models::enums::AttemptStatus::Charged)
.cloned()
.ok_or(error_stack::report!(
redis_interface::errors::RedisError::NotFound
))
})
};
Box::pin(try_redis_get_else_try_database_get(
redis_fut,
database_call,
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8954006294694490208 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
payment_id,
merchant_id,
storage_scheme,
)
};
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
merchant_id,
payment_id,
};
let pattern = "pa_*";
let redis_fut = async {
let kv_result = Box::pin(kv_wrapper::<PaymentAttempt, _, _>(
self,
KvOperation::<DieselPaymentAttempt>::Scan(pattern),
key,
))
.await?
.try_into_scan();
kv_result.and_then(|mut payment_attempts| {
payment_attempts.sort_by(|a, b| b.modified_at.cmp(&a.modified_at));
payment_attempts
.iter()
.find(|&pa| {
pa.status == api_models::enums::AttemptStatus::Charged
|| pa.status == api_models::enums::AttemptStatus::PartialCharged
})
.cloned()
.ok_or(error_stack::report!(
redis_interface::errors::RedisError::NotFound
))
})
};
Box::pin(try_redis_get_else_try_database_get(
redis_fut,
database_call,
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6060737815149315703 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &MerchantKeyStore,
payment_id: &common_utils::id_type::GlobalPaymentId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
key_manager_state,
merchant_key_store,
payment_id,
storage_scheme,
)
};
let decided_storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match decided_storage_scheme {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::GlobalPaymentId { id: payment_id };
let redis_fut = async {
let kv_result = kv_wrapper::<DieselPaymentAttempt, _, _>(
self,
KvOperation::<DieselPaymentAttempt>::Scan("pa_*"),
key.clone(),
)
.await?
.try_into_scan();
let payment_attempt = kv_result.and_then(|mut payment_attempts| {
payment_attempts.sort_by(|a, b| b.modified_at.cmp(&a.modified_at));
payment_attempts
.iter()
.find(|&pa| {
pa.status == diesel_models::enums::AttemptStatus::Charged
|| pa.status
== diesel_models::enums::AttemptStatus::PartialCharged
})
.cloned()
.ok_or(error_stack::report!(
redis_interface::errors::RedisError::NotFound
))
})?;
let merchant_id = payment_attempt.merchant_id.clone();
PaymentAttempt::convert_back(
key_manager_state,
payment_attempt,
merchant_key_store.key.get_inner(),
merchant_id.into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
};
Box::pin(try_redis_get_else_try_database_get(
redis_fut,
database_call,
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_301368020649849010 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_merchant_id_connector_txn_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
connector_txn_id: &str,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_merchant_id_connector_txn_id(
merchant_id,
connector_txn_id,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
let lookup_id = format!(
"pa_conn_trans_{}_{connector_txn_id}",
merchant_id.get_string_repr()
);
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
.find_payment_attempt_by_merchant_id_connector_txn_id(
merchant_id,
connector_txn_id,
storage_scheme,
)
.await
);
let key = PartitionKey::CombinationKey {
combination: &lookup.pk_id,
};
Box::pin(try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(
self,
KvOperation::<DieselPaymentAttempt>::HGet(&lookup.sk_id),
key,
))
.await?
.try_into_hget()
},
|| async {
self.router_store
.find_payment_attempt_by_merchant_id_connector_txn_id(
merchant_id,
connector_txn_id,
storage_scheme,
)
.await
},
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_merchant_id_connector_txn_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1517604489433432002 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &MerchantKeyStore,
profile_id: &common_utils::id_type::ProfileId,
connector_transaction_id: &str,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resource_by_id(
key_manager_state,
merchant_key_store,
storage_scheme,
DieselPaymentAttempt::find_by_profile_id_connector_transaction_id(
&conn,
profile_id,
connector_transaction_id,
),
FindResourceBy::LookupId(label::get_profile_id_connector_transaction_label(
profile_id.get_string_repr(),
connector_transaction_id,
)),
)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_profile_id_connector_transaction_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3536437766995820480 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
attempt_id: &str,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
payment_id,
merchant_id,
attempt_id,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
merchant_id,
payment_id,
};
let field = format!("pa_{attempt_id}");
Box::pin(try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(
self,
KvOperation::<DieselPaymentAttempt>::HGet(&field),
key,
))
.await?
.try_into_hget()
},
|| async {
self.router_store
.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
payment_id,
merchant_id,
attempt_id,
storage_scheme,
)
.await
},
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_payment_id_merchant_id_attempt_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4859380986451613609 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentListFilters, errors::StorageError> {
self.router_store
.get_filters_for_payments(pi, merchant_id, storage_scheme)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filters_for_payments",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4093847194692332535 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_preprocessing_id_merchant_id(
&self,
preprocessing_id: &str,
merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_preprocessing_id_merchant_id(
preprocessing_id,
merchant_id,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
let lookup_id = format!(
"pa_preprocessing_{}_{preprocessing_id}",
merchant_id.get_string_repr()
);
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
.find_payment_attempt_by_preprocessing_id_merchant_id(
preprocessing_id,
merchant_id,
storage_scheme,
)
.await
);
let key = PartitionKey::CombinationKey {
combination: &lookup.pk_id,
};
Box::pin(try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(
self,
KvOperation::<DieselPaymentAttempt>::HGet(&lookup.sk_id),
key,
))
.await?
.try_into_hget()
},
|| async {
self.router_store
.find_payment_attempt_by_preprocessing_id_merchant_id(
preprocessing_id,
merchant_id,
storage_scheme,
)
.await
},
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_preprocessing_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8289039250660865258 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_attempts_by_merchant_id_payment_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, errors::StorageError> {
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_attempts_by_merchant_id_payment_id(
merchant_id,
payment_id,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
merchant_id,
payment_id,
};
Box::pin(try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(
self,
KvOperation::<DieselPaymentAttempt>::Scan("pa_*"),
key,
))
.await?
.try_into_scan()
},
|| async {
self.router_store
.find_attempts_by_merchant_id_payment_id(
merchant_id,
payment_id,
storage_scheme,
)
.await
},
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_attempts_by_merchant_id_payment_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6013550667071349196 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_attempt_id_merchant_id(
&self,
attempt_id: &str,
merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
storage_scheme,
Op::Find,
))
.await;
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_attempt_id_merchant_id(
attempt_id,
merchant_id,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => {
let lookup_id = format!("pa_{}_{attempt_id}", merchant_id.get_string_repr());
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
.find_payment_attempt_by_attempt_id_merchant_id(
attempt_id,
merchant_id,
storage_scheme,
)
.await
);
let key = PartitionKey::CombinationKey {
combination: &lookup.pk_id,
};
Box::pin(try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(
self,
KvOperation::<DieselPaymentAttempt>::HGet(&lookup.sk_id),
key,
))
.await?
.try_into_hget()
},
|| async {
self.router_store
.find_payment_attempt_by_attempt_id_merchant_id(
attempt_id,
merchant_id,
storage_scheme,
)
.await
},
))
.await
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_attempt_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-5548899820159224019 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempt_by_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &MerchantKeyStore,
attempt_id: &common_utils::id_type::GlobalAttemptId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resource_by_id(
key_manager_state,
merchant_key_store,
storage_scheme,
DieselPaymentAttempt::find_by_id(&conn, attempt_id),
FindResourceBy::LookupId(label::get_global_id_label(attempt_id)),
)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6460337749957198822 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn find_payment_attempts_by_payment_intent_id(
&self,
key_manager_state: &KeyManagerState,
payment_id: &common_utils::id_type::GlobalPaymentId,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.filter_resources(
key_manager_state,
merchant_key_store,
storage_scheme,
DieselPaymentAttempt::find_by_payment_id(&conn, payment_id),
|_| true,
FilterResourceParams {
key: PartitionKey::GlobalPaymentId { id: payment_id },
pattern: "pa_*",
limit: None,
},
)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempts_by_payment_intent_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1282005960121997547 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &common_utils::id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method_type: Option<Vec<common_enums::PaymentMethod>>,
payment_method_subtype: Option<Vec<common_enums::PaymentMethodType>>,
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
.get_total_count_of_filtered_payment_attempts(
merchant_id,
active_attempt_ids,
connector,
payment_method_type,
payment_method_subtype,
authentication_type,
merchant_connector_id,
card_network,
storage_scheme,
)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_total_count_of_filtered_payment_attempts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1592023964514346267 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
fn to_storage_model(self) -> Self::StorageModel {
DieselPaymentAttemptNew {
net_amount: Some(self.net_amount.get_total_amount()),
payment_id: self.payment_id,
merchant_id: self.merchant_id,
attempt_id: self.attempt_id,
status: self.status,
amount: self.net_amount.get_order_amount(),
currency: self.currency,
save_to_locker: self.save_to_locker,
connector: self.connector,
error_message: self.error_message,
offer_amount: self.offer_amount,
surcharge_amount: self.net_amount.get_surcharge_amount(),
tax_amount: self.net_amount.get_tax_on_surcharge(),
payment_method_id: self.payment_method_id,
payment_method: self.payment_method,
capture_method: self.capture_method,
capture_on: self.capture_on,
confirm: self.confirm,
authentication_type: self.authentication_type,
created_at: self.created_at.unwrap_or_else(common_utils::date_time::now),
modified_at: self
.modified_at
.unwrap_or_else(common_utils::date_time::now),
last_synced: self.last_synced,
cancellation_reason: self.cancellation_reason,
amount_to_capture: self.amount_to_capture,
mandate_id: self.mandate_id,
browser_info: self.browser_info,
payment_token: self.payment_token,
error_code: self.error_code,
connector_metadata: self.connector_metadata,
payment_experience: self.payment_experience,
payment_method_type: self.payment_method_type,
card_network: self
.payment_method_data
.as_ref()
.and_then(|data| data.as_object())
.and_then(|card| card.get("card"))
.and_then(|value| value.as_object())
.and_then(|map| map.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
payment_method_data: self.payment_method_data,
business_sub_label: self.business_sub_label,
straight_through_algorithm: self.straight_through_algorithm,
preprocessing_step_id: self.preprocessing_step_id,
mandate_details: self.mandate_details.map(|d| d.to_storage_model()),
error_reason: self.error_reason,
connector_response_reference_id: self.connector_response_reference_id,
multiple_capture_count: self.multiple_capture_count,
amount_capturable: self.amount_capturable,
updated_by: self.updated_by,
authentication_data: self.authentication_data,
encoded_data: self.encoded_data,
merchant_connector_id: self.merchant_connector_id,
unified_code: self.unified_code,
unified_message: self.unified_message,
external_three_ds_authentication_attempted: self
.external_three_ds_authentication_attempted,
authentication_connector: self.authentication_connector,
authentication_id: self.authentication_id,
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
organization_id: self.organization_id,
profile_id: self.profile_id,
shipping_cost: self.net_amount.get_shipping_cost(),
order_tax_amount: self.net_amount.get_order_tax_amount(),
connector_mandate_detail: self.connector_mandate_detail,
request_extended_authorization: self.request_extended_authorization,
extended_authorization_applied: self.extended_authorization_applied,
capture_before: self.capture_before,
card_discovery: self.card_discovery,
processor_merchant_id: Some(self.processor_merchant_id),
created_by: self.created_by.map(|created_by| created_by.to_string()),
setup_future_usage_applied: self.setup_future_usage_applied,
routing_approach: self.routing_approach,
connector_request_reference_id: self.connector_request_reference_id,
network_transaction_id: self.network_transaction_id,
network_details: self.network_details,
is_stored_credential: self.is_stored_credential,
authorized_amount: self.authorized_amount,
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_storage_model",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_2784185180802012320 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
fn from_storage_model(storage_model: Self::StorageModel) -> Self {
Self {
net_amount: hyperswitch_domain_models::payments::payment_attempt::NetAmount::new(
storage_model.amount,
storage_model.shipping_cost,
storage_model.order_tax_amount,
storage_model.surcharge_amount,
storage_model.tax_amount,
),
payment_id: storage_model.payment_id,
merchant_id: storage_model.merchant_id.clone(),
attempt_id: storage_model.attempt_id,
status: storage_model.status,
currency: storage_model.currency,
save_to_locker: storage_model.save_to_locker,
connector: storage_model.connector,
error_message: storage_model.error_message,
offer_amount: storage_model.offer_amount,
payment_method_id: storage_model.payment_method_id,
payment_method: storage_model.payment_method,
capture_method: storage_model.capture_method,
capture_on: storage_model.capture_on,
confirm: storage_model.confirm,
authentication_type: storage_model.authentication_type,
created_at: Some(storage_model.created_at),
modified_at: Some(storage_model.modified_at),
last_synced: storage_model.last_synced,
cancellation_reason: storage_model.cancellation_reason,
amount_to_capture: storage_model.amount_to_capture,
mandate_id: storage_model.mandate_id,
browser_info: storage_model.browser_info,
payment_token: storage_model.payment_token,
error_code: storage_model.error_code,
connector_metadata: storage_model.connector_metadata,
payment_experience: storage_model.payment_experience,
payment_method_type: storage_model.payment_method_type,
payment_method_data: storage_model.payment_method_data,
business_sub_label: storage_model.business_sub_label,
straight_through_algorithm: storage_model.straight_through_algorithm,
preprocessing_step_id: storage_model.preprocessing_step_id,
mandate_details: storage_model
.mandate_details
.map(MandateDataType::from_storage_model),
error_reason: storage_model.error_reason,
connector_response_reference_id: storage_model.connector_response_reference_id,
multiple_capture_count: storage_model.multiple_capture_count,
amount_capturable: storage_model.amount_capturable,
updated_by: storage_model.updated_by,
authentication_data: storage_model.authentication_data,
encoded_data: storage_model.encoded_data,
merchant_connector_id: storage_model.merchant_connector_id,
unified_code: storage_model.unified_code,
unified_message: storage_model.unified_message,
external_three_ds_authentication_attempted: storage_model
.external_three_ds_authentication_attempted,
authentication_connector: storage_model.authentication_connector,
authentication_id: storage_model.authentication_id,
mandate_data: storage_model
.mandate_data
.map(MandateDetails::from_storage_model),
payment_method_billing_address_id: storage_model.payment_method_billing_address_id,
fingerprint_id: storage_model.fingerprint_id,
client_source: storage_model.client_source,
client_version: storage_model.client_version,
customer_acceptance: storage_model.customer_acceptance,
organization_id: storage_model.organization_id,
profile_id: storage_model.profile_id,
connector_mandate_detail: storage_model.connector_mandate_detail,
request_extended_authorization: storage_model.request_extended_authorization,
extended_authorization_applied: storage_model.extended_authorization_applied,
capture_before: storage_model.capture_before,
card_discovery: storage_model.card_discovery,
processor_merchant_id: storage_model
.processor_merchant_id
.unwrap_or(storage_model.merchant_id),
created_by: storage_model
.created_by
.and_then(|created_by| created_by.parse::<CreatedBy>().ok()),
setup_future_usage_applied: storage_model.setup_future_usage_applied,
routing_approach: storage_model.routing_approach,
connector_request_reference_id: storage_model.connector_request_reference_id,
network_transaction_id: storage_model.network_transaction_id,
network_details: storage_model.network_details,
is_stored_credential: storage_model.is_stored_credential,
authorized_amount: storage_model.authorized_amount,
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from_storage_model",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6869806650679516101 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn add_connector_txn_id_to_reverse_lookup<T: DatabaseStore>(
store: &KVRouterStore<T>,
key: &str,
merchant_id: &common_utils::id_type::MerchantId,
updated_attempt_attempt_id: &str,
connector_transaction_id: &str,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<ReverseLookup, errors::StorageError> {
let field = format!("pa_{updated_attempt_attempt_id}");
let reverse_lookup_new = ReverseLookupNew {
lookup_id: format!(
"pa_conn_trans_{}_{}",
merchant_id.get_string_repr(),
connector_transaction_id
),
pk_id: key.to_owned(),
sk_id: field.clone(),
source: "payment_attempt".to_string(),
updated_by: storage_scheme.to_string(),
};
store
.insert_reverse_lookup(reverse_lookup_new, storage_scheme)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_connector_txn_id_to_reverse_lookup",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8602520744974662842 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
async fn add_preprocessing_id_to_reverse_lookup<T: DatabaseStore>(
store: &KVRouterStore<T>,
key: &str,
merchant_id: &common_utils::id_type::MerchantId,
updated_attempt_attempt_id: &str,
preprocessing_id: &str,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<ReverseLookup, errors::StorageError> {
let field = format!("pa_{updated_attempt_attempt_id}");
let reverse_lookup_new = ReverseLookupNew {
lookup_id: format!(
"pa_preprocessing_{}_{}",
merchant_id.get_string_repr(),
preprocessing_id
),
pk_id: key.to_owned(),
sk_id: field.clone(),
source: "payment_attempt".to_string(),
updated_by: storage_scheme.to_string(),
};
store
.insert_reverse_lookup(reverse_lookup_new, storage_scheme)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_preprocessing_id_to_reverse_lookup",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7152435538589206820 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
pub(super) fn get_profile_id_connector_transaction_label(
profile_id: &str,
connector_transaction_id: &str,
) -> String {
format!("profile_{profile_id}_conn_txn_{connector_transaction_id}")
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_profile_id_connector_transaction_label",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6580638173138099918 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_attempt.rs
pub(super) fn get_global_id_label(
attempt_id: &common_utils::id_type::GlobalAttemptId,
) -> String {
format!("attempt_global_id_{}", attempt_id.get_string_repr())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_global_id_label",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7614071483126932914 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn insert_payment_intent(
&self,
state: &KeyManagerState,
payment_intent: PaymentIntent,
merchant_key_store: &MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_write(self).await?;
let diesel_payment_intent = payment_intent
.construct_new()
.await
.change_context(StorageError::EncryptionError)?
.insert(&conn)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
PaymentIntent::convert_back(
state,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(StorageError::DecryptionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payment_intent",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6448620745127671154 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn get_filtered_payment_intents_attempt(
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, Option<PaymentAttempt>)>, StorageError> {
use diesel::NullableExpressionMethods as _;
use futures::{future::try_join_all, FutureExt};
let conn = connection::pg_connection_read(self).await?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
.filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
.left_join(
payment_attempt_schema::table
.on(pi_dsl::active_attempt_id.eq(pa_dsl::id.nullable())),
)
// Filtering on merchant_id for payment_attempt is not required for v2 as payment_attempt_ids are globally unique
.into_boxed();
query = match constraints {
PaymentIntentFetchConstraints::List(params) => {
query = match params.order {
Order {
on: SortOn::Amount,
by: SortBy::Asc,
} => query.order(pi_dsl::amount.asc()),
Order {
on: SortOn::Amount,
by: SortBy::Desc,
} => query.order(pi_dsl::amount.desc()),
Order {
on: SortOn::Created,
by: SortBy::Asc,
} => query.order(pi_dsl::created_at.asc()),
Order {
on: SortOn::Created,
by: SortBy::Desc,
} => query.order(pi_dsl::created_at.desc()),
};
if let Some(limit) = params.limit {
query = query.limit(limit.into());
}
if let Some(customer_id) = ¶ms.customer_id {
query = query.filter(pi_dsl::customer_id.eq(customer_id.clone()));
}
if let Some(merchant_order_reference_id) = ¶ms.merchant_order_reference_id {
query = query.filter(
pi_dsl::merchant_reference_id.eq(merchant_order_reference_id.clone()),
)
}
if let Some(profile_id) = ¶ms.profile_id {
query = query.filter(pi_dsl::profile_id.eq(profile_id.clone()));
}
query = match (params.starting_at, ¶ms.starting_after_id) {
(Some(starting_at), _) => query.filter(pi_dsl::created_at.ge(starting_at)),
(None, Some(starting_after_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let starting_at = self
.find_payment_intent_by_id(
state,
starting_after_id,
merchant_key_store,
storage_scheme,
)
.await?
.created_at;
query.filter(pi_dsl::created_at.ge(starting_at))
}
(None, None) => query,
};
query = match (params.ending_at, ¶ms.ending_before_id) {
(Some(ending_at), _) => query.filter(pi_dsl::created_at.le(ending_at)),
(None, Some(ending_before_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let ending_at = self
.find_payment_intent_by_id(
state,
ending_before_id,
merchant_key_store,
storage_scheme,
)
.await?
.created_at;
query.filter(pi_dsl::created_at.le(ending_at))
}
(None, None) => query,
};
query = query.offset(params.offset.into());
query = match params.amount_filter {
Some(AmountFilter {
start_amount: Some(start),
end_amount: Some(end),
}) => query.filter(pi_dsl::amount.between(start, end)),
Some(AmountFilter {
start_amount: Some(start),
end_amount: None,
}) => query.filter(pi_dsl::amount.ge(start)),
Some(AmountFilter {
start_amount: None,
end_amount: Some(end),
}) => query.filter(pi_dsl::amount.le(end)),
_ => query,
};
query = match ¶ms.currency {
Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())),
None => query,
};
query = match ¶ms.connector {
Some(connector) => query.filter(pa_dsl::connector.eq_any(connector.clone())),
None => query,
};
query = match ¶ms.status {
Some(status) => query.filter(pi_dsl::status.eq_any(status.clone())),
None => query,
};
query = match ¶ms.payment_method_type {
Some(payment_method_type) => query
.filter(pa_dsl::payment_method_type_v2.eq_any(payment_method_type.clone())),
None => query,
};
query = match ¶ms.payment_method_subtype {
Some(payment_method_subtype) => query.filter(
pa_dsl::payment_method_subtype.eq_any(payment_method_subtype.clone()),
),
None => query,
};
query = match ¶ms.authentication_type {
Some(authentication_type) => query
.filter(pa_dsl::authentication_type.eq_any(authentication_type.clone())),
None => query,
};
query = match ¶ms.merchant_connector_id {
Some(merchant_connector_id) => query.filter(
pa_dsl::merchant_connector_id.eq_any(merchant_connector_id.clone()),
),
None => query,
};
if let Some(card_network) = ¶ms.card_network {
query = query.filter(pa_dsl::card_network.eq_any(card_network.clone()));
}
if let Some(payment_id) = ¶ms.payment_id {
query = query.filter(pi_dsl::id.eq(payment_id.clone()));
}
query
}
};
logger::debug!(filter = %diesel::debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async::<(
DieselPaymentIntent,
Option<diesel_models::payment_attempt::PaymentAttempt>,
)>(conn)
.await
.change_context(StorageError::DecryptionError)
.async_and_then(|output| async {
try_join_all(output.into_iter().map(
|(pi, pa): (_, Option<diesel_models::payment_attempt::PaymentAttempt>)| async {
let payment_intent = PaymentIntent::convert_back(
state,
pi,
merchant_key_store.key.get_inner(),
merchant_id.to_owned().into(),
);
let payment_attempt = pa
.async_map(|val| {
PaymentAttempt::convert_back(
state,
val,
merchant_key_store.key.get_inner(),
merchant_id.to_owned().into(),
)
})
.map(|val| val.transpose());
let output = futures::try_join!(payment_intent, payment_attempt);
output.change_context(StorageError::DecryptionError)
},
))
.await
})
.await
.change_context(StorageError::DecryptionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filtered_payment_intents_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8784591583838426027 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn update_payment_intent(
&self,
state: &KeyManagerState,
this: PaymentIntent,
payment_intent: PaymentIntentUpdate,
merchant_key_store: &MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_write(self).await?;
let diesel_payment_intent_update = PaymentIntentUpdateInternal::try_from(payment_intent)
.change_context(StorageError::DeserializationFailed)?;
let diesel_payment_intent = this
.convert()
.await
.change_context(StorageError::EncryptionError)?
.update(&conn, diesel_payment_intent_update)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
PaymentIntent::convert_back(
state,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(StorageError::DecryptionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payment_intent",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-2889267620334145292 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn find_payment_intent_by_payment_id_merchant_id(
&self,
state: &KeyManagerState,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
merchant_key_store: &MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
DieselPaymentIntent::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.async_and_then(|diesel_payment_intent| async {
PaymentIntent::convert_back(
state,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(StorageError::DecryptionError)
})
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_intent_by_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7747965048625563988 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn find_payment_intent_by_id(
&self,
state: &KeyManagerState,
id: &common_utils::id_type::GlobalPaymentId,
merchant_key_store: &MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
let diesel_payment_intent = DieselPaymentIntent::find_by_global_id(&conn, id)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
let merchant_id = diesel_payment_intent.merchant_id.clone();
PaymentIntent::convert_back(
state,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
merchant_id.to_owned().into(),
)
.await
.change_context(StorageError::DecryptionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_intent_by_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-2651545327584564490 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn filter_payment_intent_by_constraints(
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
filters: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
use futures::{future::try_join_all, FutureExt};
let conn = connection::pg_connection_read(self).await?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
//[#350]: Replace this with Boxable Expression and pass it into generic filter
// when https://github.com/rust-lang/rust/issues/52662 becomes stable
let mut query = <DieselPaymentIntent as HasTable>::table()
.filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
.order(pi_dsl::created_at.desc())
.into_boxed();
match filters {
PaymentIntentFetchConstraints::Single { payment_intent_id } => {
query = query.filter(pi_dsl::payment_id.eq(payment_intent_id.to_owned()));
}
PaymentIntentFetchConstraints::List(params) => {
if let Some(limit) = params.limit {
query = query.limit(limit.into());
}
if let Some(customer_id) = ¶ms.customer_id {
query = query.filter(pi_dsl::customer_id.eq(customer_id.clone()));
}
if let Some(profile_id) = ¶ms.profile_id {
query = query.filter(pi_dsl::profile_id.eq_any(profile_id.clone()));
}
query = match (params.starting_at, ¶ms.starting_after_id) {
(Some(starting_at), _) => query.filter(pi_dsl::created_at.ge(starting_at)),
(None, Some(starting_after_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let starting_at = self
.find_payment_intent_by_payment_id_merchant_id(
state,
starting_after_id,
merchant_id,
merchant_key_store,
storage_scheme,
)
.await?
.created_at;
query.filter(pi_dsl::created_at.ge(starting_at))
}
(None, None) => query,
};
query = match (params.ending_at, ¶ms.ending_before_id) {
(Some(ending_at), _) => query.filter(pi_dsl::created_at.le(ending_at)),
(None, Some(ending_before_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let ending_at = self
.find_payment_intent_by_payment_id_merchant_id(
state,
ending_before_id,
merchant_id,
merchant_key_store,
storage_scheme,
)
.await?
.created_at;
query.filter(pi_dsl::created_at.le(ending_at))
}
(None, None) => query,
};
query = query.offset(params.offset.into());
query = match ¶ms.currency {
Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())),
None => query,
};
query = match ¶ms.status {
Some(status) => query.filter(pi_dsl::status.eq_any(status.clone())),
None => query,
};
if let Some(currency) = ¶ms.currency {
query = query.filter(pi_dsl::currency.eq_any(currency.clone()));
}
if let Some(status) = ¶ms.status {
query = query.filter(pi_dsl::status.eq_any(status.clone()));
}
}
}
logger::debug!(query = %diesel::debug_query::<diesel::pg::Pg,_>(&query).to_string());
db_metrics::track_database_call::<<DieselPaymentIntent as HasTable>::Table, _, _>(
query.get_results_async::<DieselPaymentIntent>(conn),
db_metrics::DatabaseOperation::Filter,
)
.await
.map(|payment_intents| {
try_join_all(payment_intents.into_iter().map(|diesel_payment_intent| {
PaymentIntent::convert_back(
state,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
}))
.map(|join_result| join_result.change_context(StorageError::DecryptionError))
})
.map_err(|er| {
StorageError::DatabaseError(
error_stack::report!(diesel_models::errors::DatabaseError::from(er))
.attach_printable("Error filtering payment records"),
)
})?
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payment_intent_by_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8599616643387880727 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn filter_payment_intents_by_time_range_constraints(
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
time_range: &common_utils::types::TimeRange,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
// TODO: Remove this redundant function
let payment_filters = (*time_range).into();
self.filter_payment_intent_by_constraints(
state,
merchant_id,
&payment_filters,
merchant_key_store,
storage_scheme,
)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payment_intents_by_time_range_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4487834109292045266 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn get_intent_status_with_count(
&self,
merchant_id: &common_utils::id_type::MerchantId,
profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
let conn = connection::pg_connection_read(self).await?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = <DieselPaymentIntent as HasTable>::table()
.group_by(pi_dsl::status)
.select((pi_dsl::status, diesel::dsl::count_star()))
.filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
.into_boxed();
if let Some(profile_id) = profile_id_list {
query = query.filter(pi_dsl::profile_id.eq_any(profile_id));
}
query = query.filter(pi_dsl::created_at.ge(time_range.start_time));
query = match time_range.end_time {
Some(ending_at) => query.filter(pi_dsl::created_at.le(ending_at)),
None => query,
};
logger::debug!(filter = %diesel::debug_query::<diesel::pg::Pg,_>(&query).to_string());
db_metrics::track_database_call::<<DieselPaymentIntent as HasTable>::Table, _, _>(
query.get_results_async::<(common_enums::IntentStatus, i64)>(conn),
db_metrics::DatabaseOperation::Filter,
)
.await
.map_err(|er| {
StorageError::DatabaseError(
error_stack::report!(diesel_models::errors::DatabaseError::from(er))
.attach_printable("Error filtering payment records"),
)
.into()
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_intent_status_with_count",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_5665490387377826674 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
merchant_id: &common_utils::id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
let conn = connection::pg_connection_read(self).await?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
.select(pi_dsl::active_attempt_id)
.filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
.order(pi_dsl::created_at.desc())
.into_boxed();
query = match constraints {
PaymentIntentFetchConstraints::Single { payment_intent_id } => {
query.filter(pi_dsl::payment_id.eq(payment_intent_id.to_owned()))
}
PaymentIntentFetchConstraints::List(params) => {
if let Some(customer_id) = ¶ms.customer_id {
query = query.filter(pi_dsl::customer_id.eq(customer_id.clone()));
}
if let Some(merchant_order_reference_id) = ¶ms.merchant_order_reference_id {
query = query.filter(
pi_dsl::merchant_order_reference_id.eq(merchant_order_reference_id.clone()),
)
}
if let Some(profile_id) = ¶ms.profile_id {
query = query.filter(pi_dsl::profile_id.eq_any(profile_id.clone()));
}
query = match params.starting_at {
Some(starting_at) => query.filter(pi_dsl::created_at.ge(starting_at)),
None => query,
};
query = match params.ending_at {
Some(ending_at) => query.filter(pi_dsl::created_at.le(ending_at)),
None => query,
};
query = match params.amount_filter {
Some(AmountFilter {
start_amount: Some(start),
end_amount: Some(end),
}) => query.filter(pi_dsl::amount.between(start, end)),
Some(AmountFilter {
start_amount: Some(start),
end_amount: None,
}) => query.filter(pi_dsl::amount.ge(start)),
Some(AmountFilter {
start_amount: None,
end_amount: Some(end),
}) => query.filter(pi_dsl::amount.le(end)),
_ => query,
};
query = match ¶ms.currency {
Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())),
None => query,
};
query = match ¶ms.status {
Some(status) => query.filter(pi_dsl::status.eq_any(status.clone())),
None => query,
};
query
}
};
db_metrics::track_database_call::<<DieselPaymentIntent as HasTable>::Table, _, _>(
query.get_results_async::<String>(conn),
db_metrics::DatabaseOperation::Filter,
)
.await
.map_err(|er| {
StorageError::DatabaseError(
error_stack::report!(diesel_models::errors::DatabaseError::from(er))
.attach_printable("Error filtering payment records"),
)
.into()
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filtered_active_attempt_ids_for_total_count",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_84691136658677981 | clm | function | // hyperswitch/crates/storage_impl/src/payments/payment_intent.rs
async fn find_payment_intent_by_merchant_reference_id_profile_id(
&self,
state: &KeyManagerState,
merchant_reference_id: &common_utils::id_type::PaymentReferenceId,
profile_id: &common_utils::id_type::ProfileId,
merchant_key_store: &MerchantKeyStore,
_storage_scheme: &MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
let diesel_payment_intent = DieselPaymentIntent::find_by_merchant_reference_id_profile_id(
&conn,
merchant_reference_id,
profile_id,
)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})?;
let merchant_id = diesel_payment_intent.merchant_id.clone();
PaymentIntent::convert_back(
state,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
merchant_id.to_owned().into(),
)
.await
.change_context(StorageError::DecryptionError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_intent_by_merchant_reference_id_profile_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-5069956219296810821 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
pub(crate) fn get_key_without_prefix(&self) -> &str {
match self {
CacheKind::Config(key)
| CacheKind::Accounts(key)
| CacheKind::Routing(key)
| CacheKind::DecisionManager(key)
| CacheKind::Surcharge(key)
| CacheKind::CGraph(key)
| CacheKind::SuccessBasedDynamicRoutingCache(key)
| CacheKind::EliminationBasedDynamicRoutingCache(key)
| CacheKind::ContractBasedDynamicRoutingCache(key)
| CacheKind::PmFiltersCGraph(key)
| CacheKind::All(key) => key,
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_key_without_prefix",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1536714670413708698 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
fn try_from(v: RedisValue) -> Result<Self, Self::Error> {
let bytes = v.as_bytes().ok_or(errors::ValidationError::InvalidValue {
message: "InvalidValue received in pubsub".to_string(),
})?;
bytes
.parse_struct("CacheRedact")
.change_context(errors::ValidationError::InvalidValue {
message: "Unable to deserialize the value from pubsub".to_string(),
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8780653096644888728 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
fn as_any(&self) -> &dyn Any {
self
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "as_any",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7933153031842705718 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
fn from(val: CacheKey) -> Self {
if val.prefix.is_empty() {
val.key
} else {
format!("{}:{}", val.prefix, val.key)
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4358534758348255213 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b fn new(
name: &'static str,
time_to_live: u64,
time_to_idle: u64,
max_capacity: Option<u64>,
) -> Self {
// Record the metrics of manual invalidation of cache entry by the application
let eviction_listener = move |_, _, cause| {
metrics::IN_MEMORY_CACHE_EVICTION_COUNT.add(
1,
router_env::metric_attributes!(
("cache_type", name.to_owned()),
("removal_cause", format!("{:?}", cause)),
),
);
};
let mut cache_builder = MokaCache::builder()
.time_to_live(std::time::Duration::from_secs(time_to_live))
.time_to_idle(std::time::Duration::from_secs(time_to_idle))
.eviction_listener(eviction_listener);
if let Some(capacity) = max_capacity {
cache_builder = cache_builder.max_capacity(capacity * 1024 * 1024);
}
Self {
name,
inner: cache_builder.build(),
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "w(\n",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1745618249463967395 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn push<T: Cacheable>(&self, key: CacheKey, val: T) {
self.inner.insert(key.into(), Arc::new(val)).await;
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "sh<T",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-2566803756818989921 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn get_val<T: Clone + Cacheable>(&self, key: CacheKey) -> Option<T> {
let val = self.inner.get::<String>(&key.into()).await;
// Add cache hit and cache miss metrics
if val.is_some() {
metrics::IN_MEMORY_CACHE_HIT
.add(1, router_env::metric_attributes!(("cache_type", self.name)));
} else {
metrics::IN_MEMORY_CACHE_MISS
.add(1, router_env::metric_attributes!(("cache_type", self.name)));
}
let val = (*val?).as_any().downcast_ref::<T>().cloned();
val
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "t_val<T",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_66776705452800198 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn exists(&self, key: CacheKey) -> bool {
self.inner.contains_key::<String>(&key.into())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "ists(&",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1349105489700838376 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn remove(&self, key: CacheKey) {
self.inner.invalidate::<String>(&key.into()).await;
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "move(&",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7708116650505118230 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
ync fn run_pending_tasks(&self) {
self.inner.run_pending_tasks().await;
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "n_pending_tasks(&",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_528673259978174979 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
get_entry_count(&self) -> u64 {
self.inner.entry_count()
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "t_entry_count(&",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3776183659583682248 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b fn name(&self) -> &'static str {
self.name
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "me(&",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_920252670475923287 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn record_entry_count_metric(&self) {
self.run_pending_tasks().await;
metrics::IN_MEMORY_CACHE_ENTRY_COUNT.record(
self.get_entry_count(),
router_env::metric_attributes!(("cache_type", self.name)),
);
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "cord_entry_count_metric(&",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4951858378836854454 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn get_or_populate_redis<T, F, Fut>(
redis: &Arc<RedisConnectionPool>,
key: impl AsRef<str>,
fun: F,
) -> CustomResult<T, StorageError>
where
T: serde::Serialize + serde::de::DeserializeOwned + Debug,
F: FnOnce() -> Fut + Send,
Fut: futures::Future<Output = CustomResult<T, StorageError>> + Send,
{
let type_name = std::any::type_name::<T>();
let key = key.as_ref();
let redis_val = redis
.get_and_deserialize_key::<T>(&key.into(), type_name)
.await;
let get_data_set_redis = || async {
let data = fun().await?;
redis
.serialize_and_set_key(&key.into(), &data)
.await
.change_context(StorageError::KVError)?;
Ok::<_, Report<StorageError>>(data)
};
match redis_val {
Err(err) => match err.current_context() {
RedisError::NotFound | RedisError::JsonDeserializationFailed => {
get_data_set_redis().await
}
_ => Err(err
.change_context(StorageError::KVError)
.attach_printable(format!("Error while fetching cache for {type_name}"))),
},
Ok(val) => Ok(val),
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "t_or_populate_redis<T",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4358181696661743187 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn get_or_populate_in_memory<T, F, Fut>(
store: &(dyn RedisConnInterface + Send + Sync),
key: &str,
fun: F,
cache: &Cache,
) -> CustomResult<T, StorageError>
where
T: Cacheable + serde::Serialize + serde::de::DeserializeOwned + Debug + Clone,
F: FnOnce() -> Fut + Send,
Fut: futures::Future<Output = CustomResult<T, StorageError>> + Send,
{
let redis = &store
.get_redis_conn()
.change_context(StorageError::RedisError(
RedisError::RedisConnectionError.into(),
))
.attach_printable("Failed to get redis connection")?;
let cache_val = cache
.get_val::<T>(CacheKey {
key: key.to_string(),
prefix: redis.key_prefix.clone(),
})
.await;
if let Some(val) = cache_val {
Ok(val)
} else {
let val = get_or_populate_redis(redis, key, fun).await?;
cache
.push(
CacheKey {
key: key.to_string(),
prefix: redis.key_prefix.clone(),
},
val.clone(),
)
.await;
Ok(val)
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "t_or_populate_in_memory<T",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_2416903782481185939 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn redact_from_redis_and_publish<
'a,
K: IntoIterator<Item = CacheKind<'a>> + Send + Clone,
>(
store: &(dyn RedisConnInterface + Send + Sync),
keys: K,
) -> CustomResult<usize, StorageError> {
let redis_conn = store
.get_redis_conn()
.change_context(StorageError::RedisError(
RedisError::RedisConnectionError.into(),
))
.attach_printable("Failed to get redis connection")?;
let redis_keys_to_be_deleted = keys
.clone()
.into_iter()
.map(|val| val.get_key_without_prefix().to_owned().into())
.collect::<Vec<_>>();
let del_replies = redis_conn
.delete_multiple_keys(&redis_keys_to_be_deleted)
.await
.map_err(StorageError::RedisError)?;
let deletion_result = redis_keys_to_be_deleted
.into_iter()
.zip(del_replies)
.collect::<Vec<_>>();
logger::debug!(redis_deletion_result=?deletion_result);
let futures = keys.into_iter().map(|key| async {
redis_conn
.clone()
.publish(IMC_INVALIDATION_CHANNEL, key)
.await
.change_context(StorageError::KVError)
});
Ok(futures::future::try_join_all(futures)
.await?
.iter()
.sum::<usize>())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "dact_from_redis_and_publish<\n",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6507327107083596658 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn publish_and_redact<'a, T, F, Fut>(
store: &(dyn RedisConnInterface + Send + Sync),
key: CacheKind<'a>,
fun: F,
) -> CustomResult<T, StorageError>
where
F: FnOnce() -> Fut + Send,
Fut: futures::Future<Output = CustomResult<T, StorageError>> + Send,
{
let data = fun().await?;
redact_from_redis_and_publish(store, [key]).await?;
Ok(data)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "blish_and_redact<'",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7245490835219848157 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
b async fn publish_and_redact_multiple<'a, T, F, Fut, K>(
store: &(dyn RedisConnInterface + Send + Sync),
keys: K,
fun: F,
) -> CustomResult<T, StorageError>
where
F: FnOnce() -> Fut + Send,
Fut: futures::Future<Output = CustomResult<T, StorageError>> + Send,
K: IntoIterator<Item = CacheKind<'a>> + Send + Clone,
{
let data = fun().await?;
redact_from_redis_and_publish(store, keys).await?;
Ok(data)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "blish_and_redact_multiple<'",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7843596266335130093 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
ync fn construct_and_get_cache() {
let cache = Cache::new("test", 1800, 1800, None);
cache
.push(
CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string(),
},
"val".to_string(),
)
.await;
assert_eq!(
cache
.get_val::<String>(CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string()
})
.await,
Some(String::from("val"))
);
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "nstruct_and_get_cache()",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7663131574976418521 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
ync fn eviction_on_size_test() {
let cache = Cache::new("test", 2, 2, Some(0));
cache
.push(
CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string(),
},
"val".to_string(),
)
.await;
assert_eq!(
cache
.get_val::<String>(CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string()
})
.await,
None
);
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "iction_on_size_test()",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8390903868003561704 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
ync fn invalidate_cache_for_key() {
let cache = Cache::new("test", 1800, 1800, None);
cache
.push(
CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string(),
},
"val".to_string(),
)
.await;
cache
.remove(CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string(),
})
.await;
assert_eq!(
cache
.get_val::<String>(CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string()
})
.await,
None
);
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "validate_cache_for_key()",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4007607986577845050 | clm | function | // hyperswitch/crates/storage_impl/src/redis/cache.rs
ync fn eviction_on_time_test() {
let cache = Cache::new("test", 2, 2, None);
cache
.push(
CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string(),
},
"val".to_string(),
)
.await;
tokio::time::sleep(std::time::Duration::from_secs(3)).await;
assert_eq!(
cache
.get_val::<String>(CacheKey {
key: "key".to_string(),
prefix: "prefix".to_string()
})
.await,
None
);
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "iction_on_time_test()",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8514886573160377669 | clm | function | // hyperswitch/crates/storage_impl/src/redis/kv_store.rs
fn partition_number(key: PartitionKey<'_>, num_partitions: u8) -> u32 {
crc32fast::hash(key.to_string().as_bytes()) % u32::from(num_partitions)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "partition_number",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_5113568291736308550 | clm | function | // hyperswitch/crates/storage_impl/src/redis/kv_store.rs
fn shard_key(key: PartitionKey<'_>, num_partitions: u8) -> String {
format!("shard_{}", Self::partition_number(key, num_partitions))
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "shard_key",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7793612053083839484 | clm | function | // hyperswitch/crates/storage_impl/src/redis/kv_store.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Op::Insert => f.write_str("insert"),
Op::Find => f.write_str("find"),
Op::Update(p_key, _, updated_by) => {
f.write_str(&format!("update_{p_key} for updated_by_{updated_by:?}"))
}
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "fmt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6933815933904952275 | clm | function | // hyperswitch/crates/storage_impl/src/redis/kv_store.rs
pub async fn kv_wrapper<'a, T, D, S>(
store: &KVRouterStore<D>,
op: KvOperation<'a, S>,
partition_key: PartitionKey<'a>,
) -> CustomResult<KvResult<T>, RedisError>
where
T: de::DeserializeOwned,
D: crate::database::store::DatabaseStore,
S: serde::Serialize + Debug + KvStorePartition + UniqueConstraints + Sync,
{
let redis_conn = store.get_redis_conn()?;
let key = format!("{partition_key}");
let type_name = std::any::type_name::<T>();
let operation = op.to_string();
let ttl = store.ttl_for_kv;
let result = async {
match op {
KvOperation::Hset(value, sql) => {
logger::debug!(kv_operation= %operation, value = ?value);
redis_conn
.set_hash_fields(&key.into(), value, Some(ttl.into()))
.await?;
store
.push_to_drainer_stream::<S>(sql, partition_key)
.await?;
Ok(KvResult::Hset(()))
}
KvOperation::HGet(field) => {
let result = redis_conn
.get_hash_field_and_deserialize(&key.into(), field, type_name)
.await?;
Ok(KvResult::HGet(result))
}
KvOperation::Scan(pattern) => {
let result: Vec<T> = redis_conn
.hscan_and_deserialize(&key.into(), pattern, None)
.await
.and_then(|result| {
if result.is_empty() {
Err(report!(RedisError::NotFound))
} else {
Ok(result)
}
})?;
Ok(KvResult::Scan(result))
}
KvOperation::HSetNx(field, value, sql) => {
logger::debug!(kv_operation= %operation, value = ?value);
value.check_for_constraints(&redis_conn).await?;
let result = redis_conn
.serialize_and_set_hash_field_if_not_exist(&key.into(), field, value, Some(ttl))
.await?;
if matches!(result, redis_interface::HsetnxReply::KeySet) {
store
.push_to_drainer_stream::<S>(sql, partition_key)
.await?;
Ok(KvResult::HSetNx(result))
} else {
Err(report!(RedisError::SetNxFailed))
}
}
KvOperation::SetNx(value, sql) => {
logger::debug!(kv_operation= %operation, value = ?value);
let result = redis_conn
.serialize_and_set_key_if_not_exist(&key.into(), value, Some(ttl.into()))
.await?;
value.check_for_constraints(&redis_conn).await?;
if matches!(result, redis_interface::SetnxReply::KeySet) {
store
.push_to_drainer_stream::<S>(sql, partition_key)
.await?;
Ok(KvResult::SetNx(result))
} else {
Err(report!(RedisError::SetNxFailed))
}
}
KvOperation::Get => {
let result = redis_conn
.get_and_deserialize_key(&key.into(), type_name)
.await?;
Ok(KvResult::Get(result))
}
}
};
let attributes = router_env::metric_attributes!(("operation", operation.clone()));
result
.await
.inspect(|_| {
logger::debug!(kv_operation= %operation, status="success");
metrics::KV_OPERATION_SUCCESSFUL.add(1, attributes);
})
.inspect_err(|err| {
logger::error!(kv_operation = %operation, status="error", error = ?err);
metrics::KV_OPERATION_FAILED.add(1, attributes);
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "kv_wrapper",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_5579032035957524750 | clm | function | // hyperswitch/crates/storage_impl/src/redis/kv_store.rs
pub async fn decide_storage_scheme<T, D>(
store: &KVRouterStore<T>,
storage_scheme: MerchantStorageScheme,
operation: Op<'_>,
) -> MerchantStorageScheme
where
D: de::DeserializeOwned
+ serde::Serialize
+ Debug
+ KvStorePartition
+ UniqueConstraints
+ Sync,
T: crate::database::store::DatabaseStore,
{
if store.soft_kill_mode {
let ops = operation.to_string();
let updated_scheme = match operation {
Op::Insert => MerchantStorageScheme::PostgresOnly,
Op::Find => MerchantStorageScheme::RedisKv,
Op::Update(_, _, Some("postgres_only")) => MerchantStorageScheme::PostgresOnly,
Op::Update(partition_key, field, Some(_updated_by)) => {
match Box::pin(kv_wrapper::<D, _, _>(
store,
KvOperation::<D>::HGet(field),
partition_key,
))
.await
{
Ok(_) => {
metrics::KV_SOFT_KILL_ACTIVE_UPDATE.add(1, &[]);
MerchantStorageScheme::RedisKv
}
Err(_) => MerchantStorageScheme::PostgresOnly,
}
}
Op::Update(_, _, None) => MerchantStorageScheme::PostgresOnly,
};
let type_name = std::any::type_name::<D>();
logger::info!(soft_kill_mode = "decide_storage_scheme", decided_scheme = %updated_scheme, configured_scheme = %storage_scheme,entity = %type_name, operation = %ops);
updated_scheme
} else {
storage_scheme
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "decide_storage_scheme",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8904096077692898884 | clm | function | // hyperswitch/crates/storage_impl/src/redis/pub_sub.rs
async fn subscribe(&self, channel: &str) -> error_stack::Result<(), redis_errors::RedisError> {
// Spawns a task that will automatically re-subscribe to any channels or channel patterns used by the client.
self.subscriber.manage_subscriptions();
self.subscriber
.subscribe::<(), &str>(channel)
.await
.change_context(redis_errors::RedisError::SubscribeError)?;
// Spawn only one thread handling all the published messages to different channels
if self
.subscriber
.is_subscriber_handler_spawned
.compare_exchange(
false,
true,
atomic::Ordering::SeqCst,
atomic::Ordering::SeqCst,
)
.is_ok()
{
let redis_clone = self.clone();
let _task_handle = tokio::spawn(
async move {
if let Err(pubsub_error) = redis_clone.on_message().await {
logger::error!(?pubsub_error);
}
}
.in_current_span(),
);
}
Ok(())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "subscribe",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6691328988907468573 | clm | function | // hyperswitch/crates/storage_impl/src/redis/pub_sub.rs
async fn publish<'a>(
&self,
channel: &str,
key: CacheKind<'a>,
) -> error_stack::Result<usize, redis_errors::RedisError> {
let key = CacheRedact {
kind: key,
tenant: self.key_prefix.clone(),
};
self.publisher
.publish(
channel,
RedisValue::try_from(key).change_context(redis_errors::RedisError::PublishError)?,
)
.await
.change_context(redis_errors::RedisError::SubscribeError)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "publish",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8449246190653909897 | clm | function | // hyperswitch/crates/storage_impl/src/redis/pub_sub.rs
async fn on_message(&self) -> error_stack::Result<(), redis_errors::RedisError> {
logger::debug!("Started on message");
let mut rx = self.subscriber.on_message();
while let Ok(message) = rx.recv().await {
let channel_name = message.channel.to_string();
logger::debug!("Received message on channel: {channel_name}");
match channel_name.as_str() {
super::cache::IMC_INVALIDATION_CHANNEL => {
let message = match CacheRedact::try_from(RedisValue::new(message.value))
.change_context(redis_errors::RedisError::OnMessageError)
{
Ok(value) => value,
Err(err) => {
logger::error!(value_conversion_err=?err);
continue;
}
};
let key = match message.kind {
CacheKind::Config(key) => {
CONFIG_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::Accounts(key) => {
ACCOUNTS_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::CGraph(key) => {
CGRAPH_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::PmFiltersCGraph(key) => {
PM_FILTERS_CGRAPH_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::EliminationBasedDynamicRoutingCache(key) => {
ELIMINATION_BASED_DYNAMIC_ALGORITHM_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::ContractBasedDynamicRoutingCache(key) => {
CONTRACT_BASED_DYNAMIC_ALGORITHM_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::SuccessBasedDynamicRoutingCache(key) => {
SUCCESS_BASED_DYNAMIC_ALGORITHM_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::Routing(key) => {
ROUTING_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::DecisionManager(key) => {
DECISION_MANAGER_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::Surcharge(key) => {
SURCHARGE_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
CacheKind::All(key) => {
CONFIG_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
ACCOUNTS_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
CGRAPH_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
PM_FILTERS_CGRAPH_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
SUCCESS_BASED_DYNAMIC_ALGORITHM_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
ELIMINATION_BASED_DYNAMIC_ALGORITHM_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
CONTRACT_BASED_DYNAMIC_ALGORITHM_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
ROUTING_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
DECISION_MANAGER_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
SURCHARGE_CACHE
.remove(CacheKey {
key: key.to_string(),
prefix: message.tenant.clone(),
})
.await;
key
}
};
logger::debug!(
key_prefix=?message.tenant.clone(),
channel_name=?channel_name,
"Done invalidating {key}"
);
}
_ => {
logger::debug!("Received message from unknown channel: {channel_name}");
}
}
}
Ok(())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "on_message",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4025876449113329930 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
&self,
_payment_id: &common_utils::id_type::PaymentId,
_merchant_id: &common_utils::id_type::MerchantId,
_attempt_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_payment_id_merchant_id_attempt_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-448816017435964327 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn get_filters_for_payments(
&self,
_pi: &[hyperswitch_domain_models::payments::PaymentIntent],
_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters,
StorageError,
> {
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filters_for_payments",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7386894265527617368 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn get_total_count_of_filtered_payment_attempts(
&self,
_merchant_id: &id_type::MerchantId,
_active_attempt_ids: &[String],
_connector: Option<Vec<api_models::enums::Connector>>,
_payment_method_type: Option<Vec<common_enums::PaymentMethod>>,
_payment_method_subtype: Option<Vec<common_enums::PaymentMethodType>>,
_authentication_type: Option<Vec<common_enums::AuthenticationType>>,
_merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
_card_network: Option<Vec<storage_enums::CardNetwork>>,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<i64, StorageError> {
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_total_count_of_filtered_payment_attempts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1762856318014155838 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_attempt_id_merchant_id(
&self,
_attempt_id: &str,
_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_attempt_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4307129762388667723 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_id(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &MerchantKeyStore,
_attempt_id: &id_type::GlobalAttemptId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_5887762897550014565 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempts_by_payment_intent_id(
&self,
_key_manager_state: &KeyManagerState,
_id: &id_type::GlobalPaymentId,
_merchant_key_store: &MerchantKeyStore,
_storage_scheme: common_enums::MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempts_by_payment_intent_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1253385376387142146 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_preprocessing_id_merchant_id(
&self,
_preprocessing_id: &str,
_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_preprocessing_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6178329073513512624 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_merchant_id_connector_txn_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_connector_txn_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_merchant_id_connector_txn_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7197192108914641379 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &MerchantKeyStore,
_profile_id: &id_type::ProfileId,
_connector_transaction_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_profile_id_connector_transaction_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8940305700590361161 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_attempts_by_merchant_id_payment_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_payment_id: &common_utils::id_type::PaymentId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Vec<PaymentAttempt>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_attempts_by_merchant_id_payment_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3390794375679797320 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn insert_payment_attempt(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &MerchantKeyStore,
_payment_attempt: PaymentAttempt,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payment_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6168087114661141717 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn update_payment_attempt_with_attempt_id(
&self,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
let mut payment_attempts = self.payment_attempts.lock().await;
let item = payment_attempts
.iter_mut()
.find(|item| item.attempt_id == this.attempt_id)
.unwrap();
*item = PaymentAttempt::from_storage_model(
payment_attempt
.to_storage_model()
.apply_changeset(this.to_storage_model()),
);
Ok(item.clone())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payment_attempt_with_attempt_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8962070378382583177 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn update_payment_attempt(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &MerchantKeyStore,
_this: PaymentAttempt,
_payment_attempt: PaymentAttemptUpdate,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payment_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4047426559333200277 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self,
_connector_transaction_id: &common_utils::types::ConnectorTransactionId,
_payment_id: &common_utils::id_type::PaymentId,
_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8478685783368833960 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
let payment_attempts = self.payment_attempts.lock().await;
Ok(payment_attempts
.iter()
.find(|payment_attempt| {
payment_attempt.payment_id == *payment_id
&& payment_attempt.merchant_id.eq(merchant_id)
})
.cloned()
.unwrap())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4241702827331449327 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
let payment_attempts = self.payment_attempts.lock().await;
Ok(payment_attempts
.iter()
.find(|payment_attempt| {
payment_attempt.payment_id == *payment_id
&& payment_attempt.merchant_id.eq(merchant_id)
&& (payment_attempt.status == storage_enums::AttemptStatus::PartialCharged
|| payment_attempt.status == storage_enums::AttemptStatus::Charged)
})
.cloned()
.unwrap())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1233379467223260350 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_attempt.rs
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &MerchantKeyStore,
payment_id: &id_type::GlobalPaymentId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
let payment_attempts = self.payment_attempts.lock().await;
Ok(payment_attempts
.iter()
.find(|payment_attempt| {
payment_attempt.payment_id == *payment_id
&& (payment_attempt.status == storage_enums::AttemptStatus::PartialCharged
|| payment_attempt.status == storage_enums::AttemptStatus::Charged)
})
.cloned()
.unwrap())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_5276967182424932932 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn find_payout_by_merchant_id_payout_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_payout_id: &common_utils::id_type::PayoutId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Payouts, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_by_merchant_id_payout_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7611043772419101702 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn update_payout(
&self,
_this: &Payouts,
_payout_update: PayoutsUpdate,
_payout_attempt: &PayoutAttempt,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Payouts, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payout",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4491273585594032161 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn insert_payout(
&self,
_payout: PayoutsNew,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Payouts, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payout",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.