@@ -40,17 +40,8 @@ use spk_solve_graph::{
4040 State ,
4141} ;
4242
43- use crate :: solver:: ErrorFreq ;
44- use crate :: {
45- Error ,
46- ResolverCallback ,
47- Result ,
48- Solution ,
49- Solver ,
50- SolverRuntime ,
51- StatusLine ,
52- show_search_space_stats,
53- } ;
43+ use crate :: solvers:: { ErrorFreq , StepSolver , StepSolverRuntime } ;
44+ use crate :: { Error , ResolverCallback , Result , Solution , StatusLine , show_search_space_stats} ;
5445#[ cfg( feature = "statsd" ) ]
5546use crate :: {
5647 SPK_SOLUTION_PACKAGE_COUNT_METRIC ,
@@ -1101,15 +1092,15 @@ impl Display for MultiSolverKind {
11011092}
11021093
11031094struct SolverTaskSettings {
1104- solver : Solver ,
1095+ solver : StepSolver ,
11051096 solver_kind : MultiSolverKind ,
11061097 ignore_failure : bool ,
11071098}
11081099
11091100struct SolverTaskDone {
11101101 pub ( crate ) start : Instant ,
11111102 pub ( crate ) loop_outcome : LoopOutcome ,
1112- pub ( crate ) runtime : SolverRuntime ,
1103+ pub ( crate ) runtime : StepSolverRuntime ,
11131104 pub ( crate ) verbosity : u8 ,
11141105 pub ( crate ) solver_kind : MultiSolverKind ,
11151106 pub ( crate ) can_ignore_failure : bool ,
@@ -1119,7 +1110,7 @@ struct SolverTaskDone {
11191110struct SolverResult {
11201111 pub ( crate ) solver_kind : MultiSolverKind ,
11211112 pub ( crate ) solve_time : Duration ,
1122- pub ( crate ) solver : Solver ,
1113+ pub ( crate ) solver : StepSolver ,
11231114 pub ( crate ) result : Result < ( Solution , Arc < tokio:: sync:: RwLock < spk_solve_graph:: Graph > > ) > ,
11241115}
11251116
@@ -1163,7 +1154,7 @@ impl DecisionFormatter {
11631154 /// result from the first to finish.
11641155 pub async fn run_and_print_resolve (
11651156 & self ,
1166- solver : & Solver ,
1157+ solver : & StepSolver ,
11671158 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
11681159 let solvers = self . setup_solvers ( solver) ;
11691160 self . run_multi_solve ( solvers, OutputKind :: Println ) . await
@@ -1174,7 +1165,7 @@ impl DecisionFormatter {
11741165 /// won't benefit from running solvers in parallel.
11751166 pub async fn run_and_print_decisions (
11761167 & self ,
1177- runtime : & mut SolverRuntime ,
1168+ runtime : & mut StepSolverRuntime ,
11781169 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
11791170 // Note: this is only used directly by cmd_view/info when it
11801171 // runs a solve. Once 'spk info' no longer runs a solve we may
@@ -1196,7 +1187,7 @@ impl DecisionFormatter {
11961187 /// options) and takes the result from the first to finish.
11971188 pub async fn run_and_log_resolve (
11981189 & self ,
1199- solver : & Solver ,
1190+ solver : & StepSolver ,
12001191 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
12011192 let solvers = self . setup_solvers ( solver) ;
12021193 self . run_multi_solve ( solvers, OutputKind :: Tracing ) . await
@@ -1208,7 +1199,7 @@ impl DecisionFormatter {
12081199 /// parallel.
12091200 pub async fn run_and_log_decisions (
12101201 & self ,
1211- runtime : & mut SolverRuntime ,
1202+ runtime : & mut StepSolverRuntime ,
12121203 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
12131204 // Note: this is not currently used directly. We may be able
12141205 // to remove this method.
@@ -1223,7 +1214,7 @@ impl DecisionFormatter {
12231214 . await
12241215 }
12251216
1226- fn setup_solvers ( & self , base_solver : & Solver ) -> Vec < SolverTaskSettings > {
1217+ fn setup_solvers ( & self , base_solver : & StepSolver ) -> Vec < SolverTaskSettings > {
12271218 // Leave the first solver as is.
12281219 let solver_with_no_change = base_solver. clone ( ) ;
12291220
@@ -1540,7 +1531,7 @@ impl DecisionFormatter {
15401531
15411532 async fn run_solver_loop (
15421533 & self ,
1543- runtime : & mut SolverRuntime ,
1534+ runtime : & mut StepSolverRuntime ,
15441535 mut output_location : OutputKind ,
15451536 ) -> LoopOutcome {
15461537 // This block exists to shorten the scope of `runtime`'s borrow.
@@ -1576,7 +1567,7 @@ impl DecisionFormatter {
15761567 & self ,
15771568 loop_outcome : LoopOutcome ,
15781569 solve_time : Duration ,
1579- runtime : & mut SolverRuntime ,
1570+ runtime : & mut StepSolverRuntime ,
15801571 mut output_location : OutputKind ,
15811572 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
15821573 match loop_outcome {
@@ -1686,7 +1677,7 @@ impl DecisionFormatter {
16861677 async fn show_search_space_info (
16871678 & self ,
16881679 solution : & Result < Solution > ,
1689- runtime : & SolverRuntime ,
1680+ runtime : & StepSolverRuntime ,
16901681 ) -> Result < ( ) > {
16911682 if let Ok ( ref s) = * solution {
16921683 tracing:: info!( "Calculating search space stats. This may take some time..." ) ;
@@ -1713,7 +1704,7 @@ impl DecisionFormatter {
17131704 }
17141705
17151706 #[ cfg( feature = "statsd" ) ]
1716- fn send_solver_start_metrics ( & self , runtime : & SolverRuntime ) {
1707+ fn send_solver_start_metrics ( & self , runtime : & StepSolverRuntime ) {
17171708 let Some ( statsd_client) = get_metrics_client ( ) else {
17181709 return ;
17191710 } ;
@@ -1774,7 +1765,7 @@ impl DecisionFormatter {
17741765 #[ cfg( feature = "sentry" ) ]
17751766 fn add_details_to_next_sentry_event (
17761767 & self ,
1777- solver : & Solver ,
1768+ solver : & StepSolver ,
17781769 solve_duration : Duration ,
17791770 ) -> Vec < String > {
17801771 let seconds = solve_duration. as_secs_f64 ( ) ;
@@ -1831,7 +1822,7 @@ impl DecisionFormatter {
18311822 #[ cfg( feature = "sentry" ) ]
18321823 fn send_sentry_warning_message (
18331824 & self ,
1834- solver : & Solver ,
1825+ solver : & StepSolver ,
18351826 solve_duration : Duration ,
18361827 sentry_warning : SentryWarning ,
18371828 ) {
@@ -1900,7 +1891,11 @@ impl DecisionFormatter {
19001891 FormattedDecisionsIter :: new ( decisions, self . settings . clone ( ) )
19011892 }
19021893
1903- pub ( crate ) fn format_solve_stats ( & self , solver : & Solver , solve_duration : Duration ) -> String {
1894+ pub ( crate ) fn format_solve_stats (
1895+ & self ,
1896+ solver : & StepSolver ,
1897+ solve_duration : Duration ,
1898+ ) -> String {
19041899 // Show how long this solve took
19051900 let mut out: String = " Solver took: " . to_string ( ) ;
19061901 let seconds = solve_duration. as_secs_f64 ( ) ;
@@ -2130,7 +2125,7 @@ impl DecisionFormatter {
21302125impl ResolverCallback for & DecisionFormatter {
21312126 async fn solve < ' s , ' a : ' s > (
21322127 & ' s self ,
2133- r : & ' a Solver ,
2128+ r : & ' a StepSolver ,
21342129 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
21352130 self . run_and_print_resolve ( r) . await
21362131 }
@@ -2140,7 +2135,7 @@ impl ResolverCallback for &DecisionFormatter {
21402135impl ResolverCallback for DecisionFormatter {
21412136 async fn solve < ' s , ' a : ' s > (
21422137 & ' s self ,
2143- r : & ' a Solver ,
2138+ r : & ' a StepSolver ,
21442139 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
21452140 self . run_and_print_resolve ( r) . await
21462141 }
0 commit comments