@@ -40,17 +40,9 @@ 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:: step:: ErrorFreq ;
44+ use crate :: solvers:: { StepSolver , StepSolverRuntime } ;
45+ use crate :: { Error , ResolverCallback , Result , Solution , StatusLine , show_search_space_stats} ;
5446#[ cfg( feature = "statsd" ) ]
5547use crate :: {
5648 SPK_SOLUTION_PACKAGE_COUNT_METRIC ,
@@ -1101,15 +1093,15 @@ impl Display for MultiSolverKind {
11011093}
11021094
11031095struct SolverTaskSettings {
1104- solver : Solver ,
1096+ solver : StepSolver ,
11051097 solver_kind : MultiSolverKind ,
11061098 ignore_failure : bool ,
11071099}
11081100
11091101struct SolverTaskDone {
11101102 pub ( crate ) start : Instant ,
11111103 pub ( crate ) loop_outcome : LoopOutcome ,
1112- pub ( crate ) runtime : SolverRuntime ,
1104+ pub ( crate ) runtime : StepSolverRuntime ,
11131105 pub ( crate ) verbosity : u8 ,
11141106 pub ( crate ) solver_kind : MultiSolverKind ,
11151107 pub ( crate ) can_ignore_failure : bool ,
@@ -1119,7 +1111,7 @@ struct SolverTaskDone {
11191111struct SolverResult {
11201112 pub ( crate ) solver_kind : MultiSolverKind ,
11211113 pub ( crate ) solve_time : Duration ,
1122- pub ( crate ) solver : Solver ,
1114+ pub ( crate ) solver : StepSolver ,
11231115 pub ( crate ) result : Result < ( Solution , Arc < tokio:: sync:: RwLock < spk_solve_graph:: Graph > > ) > ,
11241116}
11251117
@@ -1163,7 +1155,7 @@ impl DecisionFormatter {
11631155 /// result from the first to finish.
11641156 pub async fn run_and_print_resolve (
11651157 & self ,
1166- solver : & Solver ,
1158+ solver : & StepSolver ,
11671159 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
11681160 let solvers = self . setup_solvers ( solver) ;
11691161 self . run_multi_solve ( solvers, OutputKind :: Println ) . await
@@ -1174,7 +1166,7 @@ impl DecisionFormatter {
11741166 /// won't benefit from running solvers in parallel.
11751167 pub async fn run_and_print_decisions (
11761168 & self ,
1177- runtime : & mut SolverRuntime ,
1169+ runtime : & mut StepSolverRuntime ,
11781170 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
11791171 // Note: this is only used directly by cmd_view/info when it
11801172 // runs a solve. Once 'spk info' no longer runs a solve we may
@@ -1196,7 +1188,7 @@ impl DecisionFormatter {
11961188 /// options) and takes the result from the first to finish.
11971189 pub async fn run_and_log_resolve (
11981190 & self ,
1199- solver : & Solver ,
1191+ solver : & StepSolver ,
12001192 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
12011193 let solvers = self . setup_solvers ( solver) ;
12021194 self . run_multi_solve ( solvers, OutputKind :: Tracing ) . await
@@ -1208,7 +1200,7 @@ impl DecisionFormatter {
12081200 /// parallel.
12091201 pub async fn run_and_log_decisions (
12101202 & self ,
1211- runtime : & mut SolverRuntime ,
1203+ runtime : & mut StepSolverRuntime ,
12121204 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
12131205 // Note: this is not currently used directly. We may be able
12141206 // to remove this method.
@@ -1223,7 +1215,7 @@ impl DecisionFormatter {
12231215 . await
12241216 }
12251217
1226- fn setup_solvers ( & self , base_solver : & Solver ) -> Vec < SolverTaskSettings > {
1218+ fn setup_solvers ( & self , base_solver : & StepSolver ) -> Vec < SolverTaskSettings > {
12271219 // Leave the first solver as is.
12281220 let solver_with_no_change = base_solver. clone ( ) ;
12291221
@@ -1540,7 +1532,7 @@ impl DecisionFormatter {
15401532
15411533 async fn run_solver_loop (
15421534 & self ,
1543- runtime : & mut SolverRuntime ,
1535+ runtime : & mut StepSolverRuntime ,
15441536 mut output_location : OutputKind ,
15451537 ) -> LoopOutcome {
15461538 // This block exists to shorten the scope of `runtime`'s borrow.
@@ -1576,7 +1568,7 @@ impl DecisionFormatter {
15761568 & self ,
15771569 loop_outcome : LoopOutcome ,
15781570 solve_time : Duration ,
1579- runtime : & mut SolverRuntime ,
1571+ runtime : & mut StepSolverRuntime ,
15801572 mut output_location : OutputKind ,
15811573 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
15821574 match loop_outcome {
@@ -1686,7 +1678,7 @@ impl DecisionFormatter {
16861678 async fn show_search_space_info (
16871679 & self ,
16881680 solution : & Result < Solution > ,
1689- runtime : & SolverRuntime ,
1681+ runtime : & StepSolverRuntime ,
16901682 ) -> Result < ( ) > {
16911683 if let Ok ( ref s) = * solution {
16921684 tracing:: info!( "Calculating search space stats. This may take some time..." ) ;
@@ -1713,7 +1705,7 @@ impl DecisionFormatter {
17131705 }
17141706
17151707 #[ cfg( feature = "statsd" ) ]
1716- fn send_solver_start_metrics ( & self , runtime : & SolverRuntime ) {
1708+ fn send_solver_start_metrics ( & self , runtime : & StepSolverRuntime ) {
17171709 let Some ( statsd_client) = get_metrics_client ( ) else {
17181710 return ;
17191711 } ;
@@ -1774,7 +1766,7 @@ impl DecisionFormatter {
17741766 #[ cfg( feature = "sentry" ) ]
17751767 fn add_details_to_next_sentry_event (
17761768 & self ,
1777- solver : & Solver ,
1769+ solver : & StepSolver ,
17781770 solve_duration : Duration ,
17791771 ) -> Vec < String > {
17801772 let seconds = solve_duration. as_secs_f64 ( ) ;
@@ -1831,7 +1823,7 @@ impl DecisionFormatter {
18311823 #[ cfg( feature = "sentry" ) ]
18321824 fn send_sentry_warning_message (
18331825 & self ,
1834- solver : & Solver ,
1826+ solver : & StepSolver ,
18351827 solve_duration : Duration ,
18361828 sentry_warning : SentryWarning ,
18371829 ) {
@@ -1900,7 +1892,11 @@ impl DecisionFormatter {
19001892 FormattedDecisionsIter :: new ( decisions, self . settings . clone ( ) )
19011893 }
19021894
1903- pub ( crate ) fn format_solve_stats ( & self , solver : & Solver , solve_duration : Duration ) -> String {
1895+ pub ( crate ) fn format_solve_stats (
1896+ & self ,
1897+ solver : & StepSolver ,
1898+ solve_duration : Duration ,
1899+ ) -> String {
19041900 // Show how long this solve took
19051901 let mut out: String = " Solver took: " . to_string ( ) ;
19061902 let seconds = solve_duration. as_secs_f64 ( ) ;
@@ -2130,7 +2126,7 @@ impl DecisionFormatter {
21302126impl ResolverCallback for & DecisionFormatter {
21312127 async fn solve < ' s , ' a : ' s > (
21322128 & ' s self ,
2133- r : & ' a Solver ,
2129+ r : & ' a StepSolver ,
21342130 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
21352131 self . run_and_print_resolve ( r) . await
21362132 }
@@ -2140,7 +2136,7 @@ impl ResolverCallback for &DecisionFormatter {
21402136impl ResolverCallback for DecisionFormatter {
21412137 async fn solve < ' s , ' a : ' s > (
21422138 & ' s self ,
2143- r : & ' a Solver ,
2139+ r : & ' a StepSolver ,
21442140 ) -> Result < ( Solution , Arc < tokio:: sync:: RwLock < Graph > > ) > {
21452141 self . run_and_print_resolve ( r) . await
21462142 }
0 commit comments