mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
feat(constraint_graph): make the constraint graph framework generic and move it into a separate crate (#3071)
This commit is contained in:
@ -103,6 +103,7 @@ analytics = { version = "0.1.0", path = "../analytics", optional = true }
|
||||
cards = { version = "0.1.0", path = "../cards" }
|
||||
common_enums = { version = "0.1.0", path = "../common_enums" }
|
||||
common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext", "logs"] }
|
||||
hyperswitch_constraint_graph = { version = "0.1.0", path = "../hyperswitch_constraint_graph" }
|
||||
currency_conversion = { version = "0.1.0", path = "../currency_conversion" }
|
||||
hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false }
|
||||
diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] }
|
||||
|
||||
@ -17,9 +17,9 @@ use diesel_models::enums as storage_enums;
|
||||
use error_stack::ResultExt;
|
||||
use euclid::{
|
||||
backend::{self, inputs as dsl_inputs, EuclidBackend},
|
||||
dssa::graph::{self as euclid_graph, Memoization},
|
||||
dssa::graph::{self as euclid_graph, CgraphExt},
|
||||
enums as euclid_enums,
|
||||
frontend::ast,
|
||||
frontend::{ast, dir as euclid_dir},
|
||||
};
|
||||
use kgraph_utils::{
|
||||
mca as mca_graph,
|
||||
@ -82,7 +82,9 @@ pub struct SessionRoutingPmTypeInput<'a> {
|
||||
profile_id: Option<String>,
|
||||
}
|
||||
static ROUTING_CACHE: StaticCache<CachedAlgorithm> = StaticCache::new();
|
||||
static KGRAPH_CACHE: StaticCache<euclid_graph::KnowledgeGraph<'_>> = StaticCache::new();
|
||||
static KGRAPH_CACHE: StaticCache<
|
||||
hyperswitch_constraint_graph::ConstraintGraph<'_, euclid_dir::DirValue>,
|
||||
> = StaticCache::new();
|
||||
|
||||
type RoutingResult<O> = oss_errors::CustomResult<O, errors::RoutingError>;
|
||||
|
||||
@ -542,7 +544,7 @@ pub async fn get_merchant_kgraph<'a>(
|
||||
merchant_last_modified: i64,
|
||||
#[cfg(feature = "business_profile_routing")] profile_id: Option<String>,
|
||||
transaction_type: &api_enums::TransactionType,
|
||||
) -> RoutingResult<Arc<euclid_graph::KnowledgeGraph<'a>>> {
|
||||
) -> RoutingResult<Arc<hyperswitch_constraint_graph::ConstraintGraph<'a, euclid_dir::DirValue>>> {
|
||||
let merchant_id = &key_store.merchant_id;
|
||||
|
||||
#[cfg(feature = "business_profile_routing")]
|
||||
@ -690,7 +692,13 @@ async fn perform_kgraph_filtering(
|
||||
.into_dir_value()
|
||||
.change_context(errors::RoutingError::KgraphAnalysisError)?;
|
||||
let kgraph_eligible = cached_kgraph
|
||||
.check_value_validity(dir_val, &context, &mut Memoization::new())
|
||||
.check_value_validity(
|
||||
dir_val,
|
||||
&context,
|
||||
&mut hyperswitch_constraint_graph::Memoization::new(),
|
||||
&mut hyperswitch_constraint_graph::CycleCheck::new(),
|
||||
None,
|
||||
)
|
||||
.change_context(errors::RoutingError::KgraphAnalysisError)?;
|
||||
|
||||
let filter_eligible =
|
||||
|
||||
Reference in New Issue
Block a user