Skip to content

Commit 2b01e80

Browse files
Unify HTTP servers
1 parent dcd6506 commit 2b01e80

File tree

17 files changed

+645
-442
lines changed

17 files changed

+645
-442
lines changed

Cargo.lock

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ members = [
88
"src/arrow-util",
99
"src/audit-log",
1010
"src/auth",
11+
"src/authenticator",
1112
"src/avro",
1213
"src/aws-secrets-controller",
1314
"src/aws-util",
@@ -131,6 +132,8 @@ default-members = [
131132
"src/alloc",
132133
"src/arrow-util",
133134
"src/audit-log",
135+
"src/auth",
136+
"src/authenticator",
134137
"src/avro",
135138
"src/aws-secrets-controller",
136139
"src/aws-util",
@@ -237,7 +240,6 @@ default-members = [
237240
"src/workspace-hack",
238241
"test/metabase/smoketest",
239242
"test/test-util",
240-
"src/auth",
241243
]
242244

243245
exclude = [

WORKSPACE

+2-1
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,8 @@ crates_repository(
596596
"//:src/alloc/Cargo.toml",
597597
"//:src/arrow-util/Cargo.toml",
598598
"//:src/audit-log/Cargo.toml",
599+
"//:src/auth/Cargo.toml",
600+
"//:src/authenticator/Cargo.toml",
599601
"//:src/avro/Cargo.toml",
600602
"//:src/aws-secrets-controller/Cargo.toml",
601603
"//:src/aws-util/Cargo.toml",
@@ -704,7 +706,6 @@ crates_repository(
704706
"//:test/metabase/smoketest/Cargo.toml",
705707
"//:test/test-util/Cargo.toml",
706708
"//:misc/bazel/cargo-gazelle/Cargo.toml",
707-
"//:src/auth/Cargo.toml",
708709
],
709710
rust_version = RUST_VERSION,
710711
# Restricting the set of platform triples we support _greatly_ reduces the

src/authenticator/BUILD.bazel

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Code generated by cargo-gazelle DO NOT EDIT
2+
3+
# Copyright Materialize, Inc. and contributors. All rights reserved.
4+
#
5+
# Use of this software is governed by the Business Source License
6+
# included in the LICENSE file at the root of this repository.
7+
#
8+
# As of the Change Date specified in that file, in accordance with
9+
# the Business Source License, use of this software will be governed
10+
# by the Apache License, Version 2.0.
11+
12+
load("@crates_io//:defs.bzl", "aliases", "all_crate_deps")
13+
load("@rules_rust//cargo:defs.bzl", "extract_cargo_lints")
14+
load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")
15+
16+
package(default_visibility = ["//visibility:public"])
17+
18+
rust_library(
19+
name = "mz_authenticator",
20+
srcs = glob(["src/**/*.rs"]),
21+
aliases = aliases(
22+
normal = True,
23+
proc_macro = True,
24+
),
25+
compile_data = [],
26+
crate_features = ["default"],
27+
data = [],
28+
lint_config = ":lints",
29+
proc_macro_deps = [] + all_crate_deps(proc_macro = True),
30+
rustc_env = {},
31+
rustc_flags = [],
32+
version = "0.1.0",
33+
deps = [
34+
"//src/frontegg-auth:mz_frontegg_auth",
35+
"//src/server-core:mz_server_core",
36+
] + all_crate_deps(normal = True),
37+
)
38+
39+
alias(
40+
name = "authenticator",
41+
actual = "mz_authenticator",
42+
)
43+
44+
rust_test(
45+
name = "mz_authenticator_lib_tests",
46+
size = "medium",
47+
aliases = aliases(
48+
normal = True,
49+
normal_dev = True,
50+
proc_macro = True,
51+
proc_macro_dev = True,
52+
),
53+
compile_data = [],
54+
crate = ":mz_authenticator",
55+
crate_features = ["default"],
56+
data = [],
57+
env = {},
58+
lint_config = ":lints",
59+
proc_macro_deps = [] + all_crate_deps(
60+
proc_macro = True,
61+
proc_macro_dev = True,
62+
),
63+
rustc_env = {},
64+
rustc_flags = [],
65+
version = "0.1.0",
66+
deps = [
67+
"//src/frontegg-auth:mz_frontegg_auth",
68+
"//src/server-core:mz_server_core",
69+
] + all_crate_deps(
70+
normal = True,
71+
normal_dev = True,
72+
),
73+
)
74+
75+
rust_doc_test(
76+
name = "mz_authenticator_doc_test",
77+
crate = ":mz_authenticator",
78+
deps = [
79+
"//src/frontegg-auth:mz_frontegg_auth",
80+
"//src/server-core:mz_server_core",
81+
] + all_crate_deps(
82+
normal = True,
83+
normal_dev = True,
84+
),
85+
)
86+
87+
extract_cargo_lints(
88+
name = "lints",
89+
manifest = "Cargo.toml",
90+
workspace = "@//:Cargo.toml",
91+
)

src/authenticator/Cargo.toml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "mz-authenticator"
3+
version = "0.1.0"
4+
authors = ["Materialize, Inc."]
5+
license = "proprietary"
6+
edition.workspace = true
7+
rust-version.workspace = true
8+
publish = false
9+
10+
[dependencies]
11+
mz-frontegg-auth = { path = "../frontegg-auth" }
12+
mz-server-core = { path = "../server-core" }
13+
serde = { version = "1.0.219", features = ["derive"] }
14+
workspace-hack = { version = "0.0.0", path = "../workspace-hack", optional = true }
15+
16+
[lints]
17+
workspace = true
18+
19+
[features]
20+
default = ["workspace-hack"]

src/authenticator/src/lib.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright Materialize, Inc. and contributors. All rights reserved.
2+
//
3+
// Use of this software is governed by the Business Source License
4+
// included in the LICENSE file.
5+
//
6+
// As of the Change Date specified in that file, in accordance with
7+
// the Business Source License, use of this software will be governed
8+
// by the Apache License, Version 2.0.
9+
10+
use mz_frontegg_auth::Authenticator as FronteggAuthenticator;
11+
12+
#[derive(Debug, Clone)]
13+
pub enum Authenticator {
14+
Frontegg(FronteggAuthenticator),
15+
None,
16+
}

src/environmentd/BUILD.bazel

+24
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ rust_library(
5151
"//src/adapter-types:mz_adapter_types",
5252
"//src/alloc:mz_alloc",
5353
"//src/alloc-default:mz_alloc_default",
54+
"//src/auth:mz_auth",
55+
"//src/authenticator:mz_authenticator",
5456
"//src/aws-secrets-controller:mz_aws_secrets_controller",
5557
"//src/build-info:mz_build_info",
5658
"//src/catalog:mz_catalog",
@@ -124,6 +126,8 @@ rust_test(
124126
"//src/adapter-types:mz_adapter_types",
125127
"//src/alloc:mz_alloc",
126128
"//src/alloc-default:mz_alloc_default",
129+
"//src/auth:mz_auth",
130+
"//src/authenticator:mz_authenticator",
127131
"//src/aws-secrets-controller:mz_aws_secrets_controller",
128132
"//src/build-info:mz_build_info",
129133
"//src/catalog:mz_catalog",
@@ -173,6 +177,8 @@ rust_doc_test(
173177
"//src/adapter-types:mz_adapter_types",
174178
"//src/alloc:mz_alloc",
175179
"//src/alloc-default:mz_alloc_default",
180+
"//src/auth:mz_auth",
181+
"//src/authenticator:mz_authenticator",
176182
"//src/aws-secrets-controller:mz_aws_secrets_controller",
177183
"//src/build-info:mz_build_info",
178184
"//src/catalog:mz_catalog",
@@ -254,6 +260,8 @@ rust_test(
254260
"//src/adapter-types:mz_adapter_types",
255261
"//src/alloc:mz_alloc",
256262
"//src/alloc-default:mz_alloc_default",
263+
"//src/auth:mz_auth",
264+
"//src/authenticator:mz_authenticator",
257265
"//src/aws-secrets-controller:mz_aws_secrets_controller",
258266
"//src/build-info:mz_build_info",
259267
"//src/catalog:mz_catalog",
@@ -323,6 +331,8 @@ rust_test(
323331
"//src/adapter-types:mz_adapter_types",
324332
"//src/alloc:mz_alloc",
325333
"//src/alloc-default:mz_alloc_default",
334+
"//src/auth:mz_auth",
335+
"//src/authenticator:mz_authenticator",
326336
"//src/aws-secrets-controller:mz_aws_secrets_controller",
327337
"//src/build-info:mz_build_info",
328338
"//src/catalog:mz_catalog",
@@ -392,6 +402,8 @@ rust_test(
392402
"//src/adapter-types:mz_adapter_types",
393403
"//src/alloc:mz_alloc",
394404
"//src/alloc-default:mz_alloc_default",
405+
"//src/auth:mz_auth",
406+
"//src/authenticator:mz_authenticator",
395407
"//src/aws-secrets-controller:mz_aws_secrets_controller",
396408
"//src/build-info:mz_build_info",
397409
"//src/catalog:mz_catalog",
@@ -461,6 +473,8 @@ rust_test(
461473
"//src/adapter-types:mz_adapter_types",
462474
"//src/alloc:mz_alloc",
463475
"//src/alloc-default:mz_alloc_default",
476+
"//src/auth:mz_auth",
477+
"//src/authenticator:mz_authenticator",
464478
"//src/aws-secrets-controller:mz_aws_secrets_controller",
465479
"//src/build-info:mz_build_info",
466480
"//src/catalog:mz_catalog",
@@ -530,6 +544,8 @@ rust_test(
530544
"//src/adapter-types:mz_adapter_types",
531545
"//src/alloc:mz_alloc",
532546
"//src/alloc-default:mz_alloc_default",
547+
"//src/auth:mz_auth",
548+
"//src/authenticator:mz_authenticator",
533549
"//src/aws-secrets-controller:mz_aws_secrets_controller",
534550
"//src/build-info:mz_build_info",
535551
"//src/catalog:mz_catalog",
@@ -599,6 +615,8 @@ rust_test(
599615
"//src/adapter-types:mz_adapter_types",
600616
"//src/alloc:mz_alloc",
601617
"//src/alloc-default:mz_alloc_default",
618+
"//src/auth:mz_auth",
619+
"//src/authenticator:mz_authenticator",
602620
"//src/aws-secrets-controller:mz_aws_secrets_controller",
603621
"//src/build-info:mz_build_info",
604622
"//src/catalog:mz_catalog",
@@ -668,6 +686,8 @@ rust_test(
668686
"//src/adapter-types:mz_adapter_types",
669687
"//src/alloc:mz_alloc",
670688
"//src/alloc-default:mz_alloc_default",
689+
"//src/auth:mz_auth",
690+
"//src/authenticator:mz_authenticator",
671691
"//src/aws-secrets-controller:mz_aws_secrets_controller",
672692
"//src/build-info:mz_build_info",
673693
"//src/catalog:mz_catalog",
@@ -737,6 +757,8 @@ rust_test(
737757
"//src/adapter-types:mz_adapter_types",
738758
"//src/alloc:mz_alloc",
739759
"//src/alloc-default:mz_alloc_default",
760+
"//src/auth:mz_auth",
761+
"//src/authenticator:mz_authenticator",
740762
"//src/aws-secrets-controller:mz_aws_secrets_controller",
741763
"//src/build-info:mz_build_info",
742764
"//src/catalog:mz_catalog",
@@ -804,6 +826,8 @@ rust_binary(
804826
"//src/adapter-types:mz_adapter_types",
805827
"//src/alloc:mz_alloc",
806828
"//src/alloc-default:mz_alloc_default",
829+
"//src/auth:mz_auth",
830+
"//src/authenticator:mz_authenticator",
807831
"//src/aws-secrets-controller:mz_aws_secrets_controller",
808832
"//src/build-info:mz_build_info",
809833
"//src/catalog:mz_catalog",

src/environmentd/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ libc = "0.2.172"
4040
mime = "0.3.16"
4141
mz-alloc = { path = "../alloc" }
4242
mz-alloc-default = { path = "../alloc-default", optional = true }
43+
mz-auth = { path = "../auth" }
44+
mz-authenticator = { path = "../authenticator" }
4345
mz-aws-secrets-controller = { path = "../aws-secrets-controller" }
4446
mz-build-info = { path = "../build-info" }
4547
mz-adapter = { path = "../adapter" }

src/environmentd/src/deployment/state.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::sync::{Arc, Mutex};
1515
use mz_orchestratord::controller::materialize::environmentd::DeploymentStatus;
1616
use mz_ore::channel::trigger::{self, Trigger};
1717

18+
#[derive(Debug)]
1819
enum DeploymentStateInner {
1920
Initializing,
2021
CatchingUp { _skip_trigger: Option<Trigger> },
@@ -128,7 +129,7 @@ impl DeploymentState {
128129
/// `environmentd` (e.g., the HTTP server). It provides methods to inspect the
129130
/// current leadership state, and to promote the deployment to the leader if it
130131
/// is ready to do so.
131-
#[derive(Clone)]
132+
#[derive(Debug, Clone)]
132133
pub struct DeploymentStateHandle {
133134
inner: Arc<Mutex<DeploymentStateInner>>,
134135
}

0 commit comments

Comments
 (0)