@@ -393,102 +393,78 @@ pub mod status {
393393
394394pub mod status_new {
395395 use chrono:: { DateTime , Utc } ;
396- use database:: BenchmarkSet ;
397396 use hashbrown:: HashMap ;
398397 use serde:: Serialize ;
399398
400399 #[ derive( Serialize , Debug ) ]
401400 #[ serde( rename_all = "camelCase" ) ]
402- pub struct BenchmarkRequestStatusUi {
403- pub state : String ,
404- pub completed_at : Option < DateTime < Utc > > ,
405- pub duration_s : Option < u64 > ,
401+ pub enum BenchmarkRequestStatus {
402+ Queued ,
403+ InProgress ,
404+ Completed ,
406405 }
407406
408407 #[ derive( Serialize , Debug ) ]
409408 #[ serde( rename_all = "camelCase" ) ]
410- pub struct BenchmarkRequestTypeUi {
411- pub r#type : String ,
412- pub tag : Option < String > ,
413- pub parent_sha : Option < String > ,
414- pub pr : Option < u32 > ,
409+ pub enum BenchmarkRequestType {
410+ Release ,
411+ Master ,
412+ Try ,
415413 }
416414
417415 #[ derive( Serialize , Debug ) ]
418416 #[ serde( rename_all = "camelCase" ) ]
419- pub struct BenchmarkRequestUi {
420- pub status : BenchmarkRequestStatusUi ,
421- pub request_type : BenchmarkRequestTypeUi ,
422- pub commit_date : Option < DateTime < Utc > > ,
417+ pub struct BenchmarkRequest {
418+ pub tag : String ,
419+ pub status : BenchmarkRequestStatus ,
420+ pub request_type : BenchmarkRequestType ,
423421 pub created_at : DateTime < Utc > ,
424- pub backends : Vec < String > ,
425- pub profiles : String ,
426- pub errors : Vec < String > ,
422+ pub completed_at : Option < DateTime < Utc > > ,
423+ pub duration_s : Option < u64 > ,
424+ pub errors : HashMap < String , String > ,
427425 }
428426
429427 #[ derive( Serialize , Debug ) ]
430428 #[ serde( rename_all = "camelCase" ) ]
431- pub struct BenchmarkJobStatusUi {
432- pub state : String ,
433- pub started_at : Option < DateTime < Utc > > ,
434- pub completed_at : Option < DateTime < Utc > > ,
435- pub collector_name : Option < String > ,
429+ pub enum BenchmarkJobStatus {
430+ Queued ,
431+ InProgress ,
432+ Success ,
433+ Failed ,
436434 }
437435
438436 #[ derive( Serialize , Debug ) ]
439437 #[ serde( rename_all = "camelCase" ) ]
440- pub struct BenchmarkJobUi {
438+ pub struct BenchmarkJob {
439+ pub request_tag : String ,
441440 pub target : String ,
442441 pub backend : String ,
443442 pub profile : String ,
444- pub request_tag : String ,
445- pub benchmark_set : BenchmarkSet ,
443+ pub benchmark_set : u32 ,
446444 pub created_at : DateTime < Utc > ,
447- pub status : BenchmarkJobStatusUi ,
445+ pub status : BenchmarkJobStatus ,
448446 pub deque_counter : u32 ,
449447 }
450448
451449 #[ derive( Serialize , Debug ) ]
452450 #[ serde( rename_all = "camelCase" ) ]
453- pub struct BenchmarkInProgressUi {
454- pub request : BenchmarkRequestUi ,
455- pub jobs : Vec < BenchmarkJobUi > ,
456- }
457-
458- #[ derive( Serialize , Debug , Clone ) ]
459- #[ serde( rename_all = "camelCase" ) ]
460- pub struct CollectorConfigUi {
451+ pub struct Collector {
461452 pub name : String ,
462453 pub target : String ,
463- pub benchmark_set : BenchmarkSet ,
454+ pub benchmark_set : u32 ,
464455 pub is_active : bool ,
465456 pub last_heartbeat_at : DateTime < Utc > ,
466457 pub date_added : DateTime < Utc > ,
467- }
468-
469- #[ derive( Serialize , Debug , Clone ) ]
470- #[ serde( rename_all = "camelCase" ) ]
471- pub struct CollectorInfo {
472- /// Configuration for the collector
473- pub config : CollectorConfigUi ,
474- /// Jobs that are assigned to the collector from the currently inprogress
475- /// request and possibly that request's parent.
476- pub job_ids : Vec < u32 > ,
458+ pub jobs : Vec < BenchmarkJob > ,
477459 }
478460
479461 #[ derive( Serialize , Debug ) ]
480462 #[ serde( rename_all = "camelCase" ) ]
481463 pub struct Response {
482- /// The current queue, ordered `in_progress`, ... the queue, `completed`
483- pub queue_request_tags : Vec < String > ,
484- /// Hash table of request tags to requests
485- pub requests_map : HashMap < String , BenchmarkRequestUi > ,
486- /// Hash table of job ids to jobs
487- pub job_map : HashMap < u32 , BenchmarkJobUi > ,
488- /// Hash table of benchmark set ids to CollectorInfo
489- pub collector_work_map : HashMap < u32 , CollectorInfo > ,
490- /// Request tag to a vector of job ids
491- pub tag_to_jobs : HashMap < String , Vec < u32 > > ,
464+ /// The current queue, starting from the queued request that will be benchmarked at the
465+ /// latest time, then the `in_progress` requests, and then the `completed` requests.
466+ pub requests : Vec < BenchmarkRequest > ,
467+ pub collectors : Vec < Collector > ,
492468 }
493469}
494470
0 commit comments