@@ -4,6 +4,7 @@ use nix::{sys::time::TimeValLike, time::clock_gettime};
44use runner_shared:: benchmark_results:: MarkerResult ;
55use runner_shared:: fifo:: { Command as FifoCommand , MarkerType } ;
66use runner_shared:: fifo:: { RUNNER_ACK_FIFO , RUNNER_CTL_FIFO } ;
7+ use std:: cmp:: Ordering ;
78use std:: path:: { Path , PathBuf } ;
89use std:: { collections:: HashSet , time:: Duration } ;
910use tokio:: io:: { AsyncReadExt , AsyncWriteExt } ;
@@ -62,8 +63,7 @@ impl GenericFifo {
6263 }
6364}
6465
65- // TODO: Find a better name for this (SharedBenchmarkData? BenchmarkData?)
66- pub struct FifoData {
66+ pub struct FifoBenchmarkData {
6767 /// Name and version of the integration
6868 pub integration : Option < ( String , String ) > ,
6969 pub bench_pids : HashSet < pid_t > ,
@@ -127,7 +127,7 @@ impl RunnerFifo {
127127 & mut self ,
128128 mut health_check : impl AsyncFnMut ( ) -> anyhow:: Result < bool > ,
129129 mut handle_cmd : impl AsyncFnMut ( & FifoCommand ) -> anyhow:: Result < FifoCommand > ,
130- ) -> anyhow:: Result < ( MarkerResult , FifoData ) > {
130+ ) -> anyhow:: Result < ( MarkerResult , FifoBenchmarkData ) > {
131131 let mut bench_order_by_timestamp = Vec :: < ( u64 , String ) > :: new ( ) ;
132132 let mut bench_pids = HashSet :: < pid_t > :: new ( ) ;
133133 let mut markers = Vec :: < MarkerType > :: new ( ) ;
@@ -181,6 +181,7 @@ impl RunnerFifo {
181181 benchmark_started = false ;
182182 markers. push ( MarkerType :: SampleEnd ( current_time ( ) ) ) ;
183183 }
184+ #[ allow( deprecated) ]
184185 FifoCommand :: SetIntegration { name, version } => {
185186 integration = Some ( ( name. into ( ) , version. into ( ) ) ) ;
186187 self . send_cmd ( FifoCommand :: Ack ) . await ?;
@@ -192,19 +193,20 @@ impl RunnerFifo {
192193 continue ;
193194 }
194195 FifoCommand :: SetVersion ( protocol_version) => {
195- if * protocol_version < runner_shared:: fifo:: CURRENT_PROTOCOL_VERSION {
196- panic ! (
196+ match protocol_version. cmp ( & runner_shared:: fifo:: CURRENT_PROTOCOL_VERSION ) {
197+ Ordering :: Less => panic ! (
197198 "Integration is using an incompatible protocol version ({protocol_version} < {}). Please update the integration to the latest version." ,
198199 runner_shared:: fifo:: CURRENT_PROTOCOL_VERSION
199- )
200- } else if * protocol_version > runner_shared:: fifo:: CURRENT_PROTOCOL_VERSION {
201- panic ! (
200+ ) ,
201+ Ordering :: Greater => panic ! (
202202 "Runner is using an incompatible protocol version ({} < {protocol_version}). Please update the runner to the latest version." ,
203203 runner_shared:: fifo:: CURRENT_PROTOCOL_VERSION
204- )
205- } ;
206- self . send_cmd ( FifoCommand :: Ack ) . await ?;
207- continue ;
204+ ) ,
205+ Ordering :: Equal => {
206+ self . send_cmd ( FifoCommand :: Ack ) . await ?;
207+ continue ;
208+ }
209+ }
208210 }
209211 _ => { }
210212 }
@@ -213,7 +215,7 @@ impl RunnerFifo {
213215 }
214216
215217 let marker_result = MarkerResult :: new ( & bench_order_by_timestamp, & markers) ;
216- let fifo_data = FifoData {
218+ let fifo_data = FifoBenchmarkData {
217219 integration,
218220 bench_pids,
219221 } ;
0 commit comments