@@ -13,10 +13,8 @@ use vortex::file::OpenOptionsSessionExt;
1313use vortex:: session:: VortexSession ;
1414use vortex_array:: ArrayRef ;
1515use vortex_error:: VortexExpect ;
16- use wasm_bindgen:: JsValue ;
1716
1817use super :: entry:: BenchmarkEntry ;
19- use crate :: website:: charts:: BenchmarkResponse ;
2018use crate :: website:: charts:: Benchmarks ;
2119use crate :: website:: charts:: extract_summary;
2220use crate :: website:: charts:: process_benchmarks;
@@ -170,74 +168,3 @@ pub async fn read_s3_array(session: &VortexSession, key: &str) -> VortexResult<A
170168
171169 file. scan ( ) ?. into_array_stream ( ) ?. read_all ( ) . await
172170}
173-
174- /// Reads benchmark entries from an S3 object containing a Vortex file.
175- ///
176- /// This function downloads the Vortex file from S3 using HTTP (the bucket is public), parses the
177- /// columnar struct array, and converts it to a vector of row-wise [`BenchmarkEntry`] structs.
178- ///
179- /// # Arguments
180- ///
181- /// * `session` - The Vortex session for reading files.
182- /// * `key` - The S3 object key (e.g., "test/random_access.vortex").
183- ///
184- /// # Errors
185- ///
186- /// Returns an error if:
187- /// - The HTTP request fails.
188- /// - The file is not a valid Vortex file.
189- /// - The schema does not match the expected [`BenchmarkEntry`] schema.
190- pub async fn read_benchmark_entries (
191- session : & VortexSession ,
192- key : & str ,
193- ) -> VortexResult < Vec < BenchmarkEntry > > {
194- let array = read_s3_array ( session, key) . await ?;
195- BenchmarkEntry :: vec_from_array ( & array)
196- }
197-
198- /// Fetches benchmark data and commit metadata from S3 and returns them as a JavaScript object.
199- ///
200- /// The returned object has the structure:
201- /// ```javascript
202- /// {
203- /// benchmarks: { [group_name]: { charts: { [chart_name]: { aligned_series: { [series_name]: [...] } } } } },
204- /// commits: [{ timestamp, author: { name, email }, message, commit_id }, ...]
205- /// }
206- /// ```
207- ///
208- /// # Arguments
209- ///
210- /// * `session` - The Vortex session for reading files.
211- /// * `commits_key` - S3 key for the commits Vortex file.
212- /// * `data_key` - S3 key for the benchmark data Vortex file.
213- ///
214- /// # Errors
215- ///
216- /// Returns an error if:
217- /// - Either S3 fetch fails.
218- /// - The files are not valid Vortex files.
219- /// - The schemas don't match expected formats.
220- /// - Validation fails (empty names, no data points, mismatched lengths).
221- pub async fn get_benchmark_data (
222- session : & VortexSession ,
223- commits_key : & str ,
224- data_key : & str ,
225- ) -> VortexResult < JsValue > {
226- let ( data_array, commits_array) = futures:: try_join!(
227- read_s3_array( session, data_key) ,
228- read_s3_array( session, commits_key)
229- ) ?;
230-
231- let data = BenchmarkEntry :: vec_from_array ( & data_array) ?;
232- let mut commits = CommitInfo :: vec_from_array ( & commits_array) ?;
233- commits. sort_unstable ( ) ;
234-
235- let benchmarks = process_benchmarks ( & data, & commits) ?;
236- let response = BenchmarkResponse {
237- benchmarks,
238- commits,
239- } ;
240-
241- serde_wasm_bindgen:: to_value ( & response)
242- . map_err ( |e| vortex_err ! ( "Failed to serialize benchmark response: {e}" ) )
243- }
0 commit comments