Skip to content

Commit 22059e9

Browse files
committed
Remove vestigial routes for distinct version information
1 parent e071d42 commit 22059e9

File tree

2 files changed

+1
-164
lines changed

2 files changed

+1
-164
lines changed

ui/src/metrics.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ pub(crate) enum Endpoint {
8686
MacroExpansion,
8787
MetaCrates,
8888
MetaVersions,
89-
MetaVersionStable,
90-
MetaVersionBeta,
91-
MetaVersionNightly,
92-
MetaVersionRustfmt,
93-
MetaVersionClippy,
94-
MetaVersionMiri,
9589
Evaluate,
9690
}
9791

ui/src/server_axum.rs

Lines changed: 1 addition & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ use axum_extra::{
2626
TypedHeader,
2727
};
2828
use futures::{future::BoxFuture, FutureExt};
29-
use orchestrator::coordinator::{
30-
self, CoordinatorFactory, DockerBackend, Versions, TRACKED_CONTAINERS,
31-
};
29+
use orchestrator::coordinator::{self, CoordinatorFactory, DockerBackend, TRACKED_CONTAINERS};
3230
use snafu::prelude::*;
3331
use std::{
3432
convert::TryInto,
@@ -90,12 +88,6 @@ pub(crate) async fn serve(config: Config) {
9088
.route("/macro-expansion", post(macro_expansion))
9189
.route("/meta/crates", get_or_post(meta_crates))
9290
.route("/meta/versions", get(meta_versions))
93-
.route("/meta/version/stable", get_or_post(meta_version_stable))
94-
.route("/meta/version/beta", get_or_post(meta_version_beta))
95-
.route("/meta/version/nightly", get_or_post(meta_version_nightly))
96-
.route("/meta/version/rustfmt", get_or_post(meta_version_rustfmt))
97-
.route("/meta/version/clippy", get_or_post(meta_version_clippy))
98-
.route("/meta/version/miri", get_or_post(meta_version_miri))
9991
.route("/meta/gist", post(meta_gist_create))
10092
.route("/meta/gist/", post(meta_gist_create)) // compatibility with lax frontend code
10193
.route("/meta/gist/:id", get(meta_gist_get))
@@ -506,76 +498,6 @@ async fn meta_versions(
506498
apply_timestamped_caching(value, if_none_match)
507499
}
508500

509-
async fn meta_version_stable(
510-
Extension(factory): Extension<Factory>,
511-
Extension(cache): Extension<Arc<SandboxCache>>,
512-
if_none_match: Option<TypedHeader<IfNoneMatch>>,
513-
) -> Result<impl IntoResponse> {
514-
let value = track_metric_no_request_async(Endpoint::MetaVersionStable, || {
515-
cache.version_stable(&factory.0)
516-
})
517-
.await?;
518-
apply_timestamped_caching(value, if_none_match)
519-
}
520-
521-
async fn meta_version_beta(
522-
Extension(factory): Extension<Factory>,
523-
Extension(cache): Extension<Arc<SandboxCache>>,
524-
if_none_match: Option<TypedHeader<IfNoneMatch>>,
525-
) -> Result<impl IntoResponse> {
526-
let value =
527-
track_metric_no_request_async(Endpoint::MetaVersionBeta, || cache.version_beta(&factory.0))
528-
.await?;
529-
apply_timestamped_caching(value, if_none_match)
530-
}
531-
532-
async fn meta_version_nightly(
533-
Extension(factory): Extension<Factory>,
534-
Extension(cache): Extension<Arc<SandboxCache>>,
535-
if_none_match: Option<TypedHeader<IfNoneMatch>>,
536-
) -> Result<impl IntoResponse> {
537-
let value = track_metric_no_request_async(Endpoint::MetaVersionNightly, || {
538-
cache.version_nightly(&factory.0)
539-
})
540-
.await?;
541-
apply_timestamped_caching(value, if_none_match)
542-
}
543-
544-
async fn meta_version_rustfmt(
545-
Extension(factory): Extension<Factory>,
546-
Extension(cache): Extension<Arc<SandboxCache>>,
547-
if_none_match: Option<TypedHeader<IfNoneMatch>>,
548-
) -> Result<impl IntoResponse> {
549-
let value = track_metric_no_request_async(Endpoint::MetaVersionRustfmt, || {
550-
cache.version_rustfmt(&factory.0)
551-
})
552-
.await?;
553-
apply_timestamped_caching(value, if_none_match)
554-
}
555-
556-
async fn meta_version_clippy(
557-
Extension(factory): Extension<Factory>,
558-
Extension(cache): Extension<Arc<SandboxCache>>,
559-
if_none_match: Option<TypedHeader<IfNoneMatch>>,
560-
) -> Result<impl IntoResponse> {
561-
let value = track_metric_no_request_async(Endpoint::MetaVersionClippy, || {
562-
cache.version_clippy(&factory.0)
563-
})
564-
.await?;
565-
apply_timestamped_caching(value, if_none_match)
566-
}
567-
568-
async fn meta_version_miri(
569-
Extension(factory): Extension<Factory>,
570-
Extension(cache): Extension<Arc<SandboxCache>>,
571-
if_none_match: Option<TypedHeader<IfNoneMatch>>,
572-
) -> Result<impl IntoResponse> {
573-
let value =
574-
track_metric_no_request_async(Endpoint::MetaVersionMiri, || cache.version_miri(&factory.0))
575-
.await?;
576-
apply_timestamped_caching(value, if_none_match)
577-
}
578-
579501
fn apply_timestamped_caching<T>(
580502
value: Stamped<T>,
581503
if_none_match: Option<TypedHeader<IfNoneMatch>>,
@@ -751,7 +673,6 @@ type Stamped<T> = (T, SystemTime);
751673
struct SandboxCache {
752674
crates: CacheOne<api::MetaCratesResponse>,
753675
versions: CacheOne<api::MetaVersionsResponse>,
754-
raw_versions: CacheOne<Arc<Versions>>,
755676
}
756677

757678
impl SandboxCache {
@@ -792,81 +713,6 @@ impl SandboxCache {
792713

793714
v
794715
}
795-
796-
async fn raw_versions(&self, factory: &CoordinatorFactory) -> Result<Stamped<Arc<Versions>>> {
797-
let coordinator = factory.build::<DockerBackend>();
798-
799-
let rv = self
800-
.raw_versions
801-
.fetch(|| async {
802-
Ok(Arc::new(
803-
coordinator.versions().await.context(VersionsSnafu)?,
804-
))
805-
})
806-
.await;
807-
808-
coordinator
809-
.shutdown()
810-
.await
811-
.context(ShutdownCoordinatorSnafu)?;
812-
813-
rv
814-
}
815-
816-
async fn version_stable(
817-
&self,
818-
factory: &CoordinatorFactory,
819-
) -> Result<Stamped<api::MetaVersionResponse>> {
820-
let (v, t) = self.raw_versions(factory).await?;
821-
let v = (&v.stable.rustc).into();
822-
Ok((v, t))
823-
}
824-
825-
async fn version_beta(
826-
&self,
827-
factory: &CoordinatorFactory,
828-
) -> Result<Stamped<api::MetaVersionResponse>> {
829-
let (v, t) = self.raw_versions(factory).await?;
830-
let v = (&v.beta.rustc).into();
831-
Ok((v, t))
832-
}
833-
834-
async fn version_nightly(
835-
&self,
836-
factory: &CoordinatorFactory,
837-
) -> Result<Stamped<api::MetaVersionResponse>> {
838-
let (v, t) = self.raw_versions(factory).await?;
839-
let v = (&v.nightly.rustc).into();
840-
Ok((v, t))
841-
}
842-
843-
async fn version_rustfmt(
844-
&self,
845-
factory: &CoordinatorFactory,
846-
) -> Result<Stamped<api::MetaVersionResponse>> {
847-
let (v, t) = self.raw_versions(factory).await?;
848-
let v = (&v.nightly.rustfmt).into();
849-
Ok((v, t))
850-
}
851-
852-
async fn version_clippy(
853-
&self,
854-
factory: &CoordinatorFactory,
855-
) -> Result<Stamped<api::MetaVersionResponse>> {
856-
let (v, t) = self.raw_versions(factory).await?;
857-
let v = (&v.nightly.clippy).into();
858-
Ok((v, t))
859-
}
860-
861-
async fn version_miri(
862-
&self,
863-
factory: &CoordinatorFactory,
864-
) -> Result<Stamped<api::MetaVersionResponse>> {
865-
let (v, t) = self.raw_versions(factory).await?;
866-
let v = v.nightly.miri.as_ref().context(MiriVersionSnafu)?;
867-
let v = v.into();
868-
Ok((v, t))
869-
}
870716
}
871717

872718
#[derive(Debug)]
@@ -1063,9 +909,6 @@ enum Error {
1063909
source: orchestrator::coordinator::VersionsError,
1064910
},
1065911

1066-
#[snafu(display("The Miri version was missing"))]
1067-
MiriVersion,
1068-
1069912
#[snafu(display("Unable to shutdown the coordinator"))]
1070913
ShutdownCoordinator {
1071914
source: orchestrator::coordinator::Error,

0 commit comments

Comments
 (0)