@@ -3,21 +3,12 @@ use std::collections::HashMap;
33use std:: sync:: Arc ;
44
55use crate :: api:: graphs:: GraphKind ;
6- use crate :: api:: { graph , graphs, ServerResult } ;
6+ use crate :: api:: { graphs, ServerResult } ;
77use crate :: db:: { self , ArtifactId , Profile , Scenario } ;
88use crate :: interpolate:: IsInterpolated ;
99use crate :: load:: SiteCtxt ;
1010use crate :: selector:: { CompileBenchmarkQuery , CompileTestCase , Selector , SeriesResponse } ;
1111
12- pub async fn handle_graph (
13- request : graph:: Request ,
14- ctxt : Arc < SiteCtxt > ,
15- ) -> ServerResult < graph:: Response > {
16- log:: info!( "handle_graph({:?})" , request) ;
17-
18- create_graph ( request, ctxt) . await
19- }
20-
2112pub async fn handle_graphs (
2213 request : graphs:: Request ,
2314 ctxt : Arc < SiteCtxt > ,
@@ -51,31 +42,6 @@ pub async fn handle_graphs(
5142 Ok ( resp)
5243}
5344
54- async fn create_graph (
55- request : graph:: Request ,
56- ctxt : Arc < SiteCtxt > ,
57- ) -> ServerResult < graph:: Response > {
58- let artifact_ids = artifact_ids_for_range ( & ctxt, request. start , request. end ) ;
59- let mut series_iterator = ctxt
60- . statistic_series (
61- CompileBenchmarkQuery :: default ( )
62- . benchmark ( Selector :: One ( request. benchmark ) )
63- . profile ( Selector :: One ( request. profile . parse ( ) ?) )
64- . scenario ( Selector :: One ( request. scenario . parse ( ) ?) )
65- . metric ( Selector :: One ( request. metric . parse ( ) ?) ) ,
66- Arc :: new ( artifact_ids) ,
67- )
68- . await ?
69- . into_iter ( )
70- . map ( SeriesResponse :: interpolate) ;
71-
72- let result = series_iterator. next ( ) . unwrap ( ) ;
73- let graph_series = graph_series ( result. series , request. kind ) ;
74- Ok ( graph:: Response {
75- series : graph_series,
76- } )
77- }
78-
7945async fn create_graphs (
8046 request : graphs:: Request ,
8147 ctxt : & SiteCtxt ,
@@ -145,19 +111,6 @@ async fn create_graphs(
145111 } ) )
146112}
147113
148- /// Returns artifact IDs for the given range.
149- /// Inside of the range (not at the start/end), only master commits are kept.
150- fn artifact_ids_for_range ( ctxt : & SiteCtxt , start : Bound , end : Bound ) -> Vec < ArtifactId > {
151- let range = ctxt. data_range ( start..=end) ;
152- let count = range. len ( ) ;
153- range
154- . into_iter ( )
155- . enumerate ( )
156- . filter ( |( index, commit) | * index == 0 || * index == count - 1 || commit. is_master ( ) )
157- . map ( |c| c. 1 . into ( ) )
158- . collect ( )
159- }
160-
161114/// Returns master commit artifact IDs for the given range.
162115fn master_artifact_ids_for_range ( ctxt : & SiteCtxt , start : Bound , end : Bound ) -> Vec < ArtifactId > {
163116 ctxt. data_range ( start..=end)
0 commit comments