Skip to content

Commit d057abb

Browse files
committed
remove unused db mod from site
1 parent b55fe76 commit d057abb

File tree

11 files changed

+23
-25
lines changed

11 files changed

+23
-25
lines changed

site/src/comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! comparison endpoints
44
55
use crate::api;
6-
use crate::db::{ArtifactId, Benchmark, Lookup, Profile, Scenario};
76
use crate::github;
87
use crate::load::SiteCtxt;
98

@@ -13,6 +12,7 @@ use database::{
1312
comparison::Metric,
1413
selector::{self, BenchmarkQuery, CompileBenchmarkQuery, RuntimeBenchmarkQuery, TestCase},
1514
};
15+
use database::{ArtifactId, Benchmark, Lookup, Profile, Scenario};
1616
use serde::Serialize;
1717

1818
use crate::api::comparison::CompileBenchmarkMetadata;

site/src/db.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

site/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
extern crate itertools;
33

44
pub mod api;
5-
pub mod db;
65
pub mod github;
76
pub mod load;
87
pub mod server;

site/src/load.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use parking_lot::Mutex;
1212
use regex::Regex;
1313
use serde::{Deserialize, Serialize};
1414

15-
use crate::db;
1615
use crate::self_profile::SelfProfileCache;
1716
use collector::compile::benchmark::category::Category;
1817
use collector::{Bound, MasterCommit};
@@ -128,7 +127,7 @@ pub struct SiteCtxt {
128127
/// Cached site landing page
129128
pub landing_page: ArcSwap<Option<Arc<crate::api::graphs::Response>>>,
130129
/// Index of various common queries
131-
pub index: ArcSwap<crate::db::Index>,
130+
pub index: ArcSwap<database::Index>,
132131
/// Cached master-branch Rust commits
133132
pub master_commits: Arc<ArcSwap<MasterCommitCache>>, // outer Arc enables mutation in background task
134133
/// Cache for self profile data
@@ -138,12 +137,12 @@ pub struct SiteCtxt {
138137
}
139138

140139
impl SiteCtxt {
141-
pub fn summary_scenarios(&self) -> Vec<crate::db::Scenario> {
140+
pub fn summary_scenarios(&self) -> Vec<database::Scenario> {
142141
vec![
143-
crate::db::Scenario::Empty,
144-
crate::db::Scenario::IncrementalEmpty,
145-
crate::db::Scenario::IncrementalFresh,
146-
crate::db::Scenario::IncrementalPatch("println".into()),
142+
database::Scenario::Empty,
143+
database::Scenario::IncrementalEmpty,
144+
database::Scenario::IncrementalFresh,
145+
database::Scenario::IncrementalPatch("println".into()),
147146
]
148147
}
149148

@@ -160,7 +159,7 @@ impl SiteCtxt {
160159
let pool = Pool::open(db_url);
161160

162161
let mut conn = pool.connection().await;
163-
let index = db::Index::load(&mut *conn).await;
162+
let index = database::Index::load(&mut *conn).await;
164163

165164
let config = if let Ok(s) = fs::read_to_string("site-config.toml") {
166165
toml::from_str(&s)?

site/src/request_handlers/bootstrap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use futures::stream::{FuturesOrdered, StreamExt};
22

33
use crate::api::{bootstrap, ServerResult};
4-
use crate::db::ArtifactId;
54
use crate::load::SiteCtxt;
5+
use database::ArtifactId;
66

77
use std::time::Duration;
88

site/src/request_handlers/dashboard.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use std::sync::Arc;
22

3-
use database::selector;
43
use lazy_static::lazy_static;
54

65
use crate::api::{dashboard, ServerResult};
76
use crate::benchmark_metadata::get_stable_benchmark_names;
8-
use crate::db::{self, comparison::Metric, ArtifactId, Profile, Scenario};
97
use crate::load::SiteCtxt;
8+
use database::selector;
9+
use database::{self, comparison::Metric, ArtifactId, Profile, Scenario};
1010

1111
pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Response> {
1212
let index = ctxt.index.load();
@@ -104,7 +104,7 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
104104
)
105105
.await?;
106106

107-
let points = db::average(
107+
let points = crate::average::average(
108108
responses
109109
.into_iter()
110110
.map(|sr| sr.interpolate().series)
@@ -139,7 +139,7 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
139139

140140
// The flag is used to ignore only the initial values where the runtime benchmark was not implemented.
141141
let mut ignore_runtime_benchmark = true;
142-
let points = db::average(
142+
let points = crate::average::average(
143143
responses
144144
.into_iter()
145145
.map(|sr| sr.interpolate().series)

site/src/request_handlers/graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ use collector::Bound;
66
use crate::api::detail_sections::CompilationSections;
77
use crate::api::graphs::GraphKind;
88
use crate::api::{detail_graphs, detail_sections, graphs, runtime_detail_graphs, ServerResult};
9-
use crate::db::{self, ArtifactId, Profile, Scenario};
109
use crate::load::SiteCtxt;
1110
use crate::self_profile::get_or_download_self_profile;
1211

1312
use database::interpolate::IsInterpolated;
1413
use database::selector::{
1514
CompileBenchmarkQuery, CompileTestCase, RuntimeBenchmarkQuery, Selector, SeriesResponse,
1615
};
16+
use database::{self, ArtifactId, Profile, Scenario};
1717

1818
/// Returns data for before/after graphs when comparing a single test result comparison
1919
/// for a compile-time benchmark.
@@ -321,7 +321,7 @@ fn create_summary(
321321
.map(|sr| sr.series.iter().cloned())
322322
.collect();
323323

324-
let value = db::average(baseline_responses)
324+
let value = crate::average::average(baseline_responses)
325325
.next()
326326
.map_or(0.0, |((_c, d), _interpolated)| d.expect("interpolated"));
327327
*v.insert(value)
@@ -338,7 +338,7 @@ fn create_summary(
338338
.map(|sr| sr.series.iter().cloned())
339339
.collect();
340340

341-
let avg_vs_baseline = db::average(summary_case_responses)
341+
let avg_vs_baseline = crate::average::average(summary_case_responses)
342342
.map(|((c, d), i)| ((c, Some(d.expect("interpolated") / baseline)), i));
343343

344344
let graph_series = graph_series(avg_vs_baseline, graph_kind);

site/src/request_handlers/self_profile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use std::time::Instant;
55

66
use bytes::Buf;
77
use database::selector;
8+
use database::ArtifactId;
89
use database::{comparison::Metric, CommitType};
910
use headers::{ContentType, Header};
1011
use hyper::StatusCode;
1112

1213
use crate::api::self_profile::ArtifactSizeDelta;
1314
use crate::api::{self_profile, self_profile_processed, self_profile_raw, ServerResult};
14-
use crate::db::ArtifactId;
1515
use crate::load::SiteCtxt;
1616
use crate::self_profile::{get_or_download_self_profile, get_self_profile_raw_data};
1717
use crate::server::{Response, ResponseHeaders};

site/src/request_handlers/status_page.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use std::sync::Arc;
33

44
use crate::api::status;
55
use crate::api::status::FinishedRun;
6-
use crate::db::{ArtifactId, Lookup};
76
use crate::load::SiteCtxt;
87

8+
use database::{ArtifactId, Lookup};
9+
910
// How many historical (finished) runs should be returned from the status API.
1011
const FINISHED_RUN_COUNT: u64 = 5;
1112

site/src/selector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::db::ArtifactId;
21
use crate::load::SiteCtxt;
32

43
use collector::Bound;
54
use database::selector::StatisticSeries;
65
use database::selector::{BenchmarkQuery, SeriesResponse};
6+
use database::ArtifactId;
77
use database::{Commit, Index};
88

99
use std::ops::RangeInclusive;

site/src/server.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ pub use crate::api::{
2424
self, bootstrap, comparison, dashboard, github, graphs, info, self_profile, self_profile_raw,
2525
status, triage, ServerResult,
2626
};
27-
use crate::db::{self, ArtifactId};
2827
use crate::load::{Config, SiteCtxt};
2928
use crate::request_handlers;
3029
use crate::resources::{Payload, ResourceResolver};
3130

31+
use database::{self, ArtifactId};
32+
3233
pub type Request = http::Request<hyper::Body>;
3334
pub type Response = http::Response<hyper::Body>;
3435

@@ -295,7 +296,7 @@ impl Server {
295296
let ctxt: Arc<SiteCtxt> = self.ctxt.read().as_ref().unwrap().clone();
296297
let _updating = self.updating.release_on_drop(channel);
297298
let mut conn = ctxt.conn().await;
298-
let index = db::Index::load(&mut *conn).await;
299+
let index = database::Index::load(&mut *conn).await;
299300
eprintln!("index has {} commits", index.commits().len());
300301
ctxt.index.store(Arc::new(index));
301302

0 commit comments

Comments
 (0)