From 347548000cab0ac549f8f23e2a0ce9e1147b7640 Mon Sep 17 00:00:00 2001 From: Ivan Nikulin Date: Fri, 19 Jan 2024 18:22:48 +0000 Subject: [PATCH] Rename the library. --- .gitmodules | 4 +- Cargo.toml | 13 +-- README.md | 10 +-- RELEASE_NOTES.md | 6 +- examples/Cargo.toml | 2 +- examples/http_server/main.rs | 16 ++-- examples/http_server/metrics.rs | 2 +- examples/http_server/settings.rs | 8 +- .../Cargo.toml | 4 +- .../src/common.rs | 0 .../src/info_metric/mod.rs | 16 ++-- .../src/info_metric/parsing.rs | 0 .../src/lib.rs | 0 .../src/metrics/mod.rs | 90 ++++++++++--------- .../src/metrics/parsing.rs | 0 .../src/settings.rs | 90 +++++++++---------- .../src/span_fn.rs | 10 +-- .../src/with_test_telemetry.rs | 6 +- {bedrock => foundations}/Cargo.toml | 13 +-- {bedrock => foundations}/build.rs | 0 {bedrock => foundations}/src/cli.rs | 2 +- {bedrock => foundations}/src/lib.rs | 12 +-- .../security/common_syscall_allow_lists.rs | 0 .../src/security/include/sys-deps.h | 0 .../src/security/internal.rs | 0 .../src/security/libseccomp | 0 {bedrock => foundations}/src/security/mod.rs | 32 +++---- .../src/security/syscalls/aarch64.rs | 0 .../src/security/syscalls/mod.rs | 0 .../src/security/syscalls/x86_64.rs | 0 .../src/settings/basic_impls.rs | 0 .../src/settings/collections.rs | 0 {bedrock => foundations}/src/settings/mod.rs | 54 +++++++---- {bedrock => foundations}/src/settings/net.rs | 0 .../src/telemetry/log/field_dedup.rs | 2 +- .../src/telemetry/log/field_filtering.rs | 0 .../src/telemetry/log/field_redact.rs | 2 +- .../src/telemetry/log/init.rs | 0 .../src/telemetry/log/internal.rs | 0 .../src/telemetry/log/log_volume.rs | 6 +- .../src/telemetry/log/mod.rs | 40 ++++----- .../src/telemetry/log/rate_limit.rs | 0 .../src/telemetry/log/testing.rs | 0 .../src/telemetry/memory_profiler.rs | 8 +- .../src/telemetry/metrics/init.rs | 0 .../src/telemetry/metrics/internal.rs | 0 .../src/telemetry/metrics/mod.rs | 28 +++--- {bedrock => foundations}/src/telemetry/mod.rs | 50 +++++------ .../src/telemetry/scope.rs | 0 .../src/telemetry/server.rs | 0 .../src/telemetry/settings/logging.rs | 2 +- .../src/telemetry/settings/memory_profiler.rs | 0 .../src/telemetry/settings/metrics.rs | 0 .../src/telemetry/settings/mod.rs | 0 .../src/telemetry/settings/rate_limit.rs | 0 .../src/telemetry/settings/server.rs | 0 .../src/telemetry/settings/tracing.rs | 0 .../src/telemetry/testing.rs | 0 .../src/telemetry/tracing/init.rs | 0 .../src/telemetry/tracing/internal.rs | 0 .../src/telemetry/tracing/mod.rs | 50 +++++------ .../src/telemetry/tracing/rate_limit.rs | 0 .../src/telemetry/tracing/testing.rs | 4 +- {bedrock => foundations}/src/utils.rs | 0 .../tests/data/settings_complex.yaml | 0 .../tests/data/settings_enum_fields.yaml | 0 .../data/settings_nested_duplicate_field.yaml | 0 .../tests/data/settings_nested_struct.yaml | 0 .../settings_simple_config_with_docs.yaml | 0 .../tests/data/with_map.yaml | 0 .../tests/data/with_option_none.yaml | 0 .../tests/data/with_option_some.yaml | 0 {bedrock => foundations}/tests/logging.rs | 8 +- {bedrock => foundations}/tests/settings.rs | 12 +-- .../tests/telemetry_server.rs | 12 +-- {bedrock => foundations}/tests/tracing.rs | 8 +- .../tests/with_test_telemetry.rs | 4 +- tools/gen-syscall-enum/src/main.rs | 2 +- 78 files changed, 327 insertions(+), 301 deletions(-) rename {bedrock-macros => foundations-macros}/Cargo.toml (80%) rename {bedrock-macros => foundations-macros}/src/common.rs (100%) rename {bedrock-macros => foundations-macros}/src/info_metric/mod.rs (91%) rename {bedrock-macros => foundations-macros}/src/info_metric/parsing.rs (100%) rename {bedrock-macros => foundations-macros}/src/lib.rs (100%) rename {bedrock-macros => foundations-macros}/src/metrics/mod.rs (82%) rename {bedrock-macros => foundations-macros}/src/metrics/parsing.rs (100%) rename {bedrock-macros => foundations-macros}/src/settings.rs (87%) rename {bedrock-macros => foundations-macros}/src/span_fn.rs (96%) rename {bedrock-macros => foundations-macros}/src/with_test_telemetry.rs (96%) rename {bedrock => foundations}/Cargo.toml (95%) rename {bedrock => foundations}/build.rs (100%) rename {bedrock => foundations}/src/cli.rs (97%) rename {bedrock => foundations}/src/lib.rs (91%) rename {bedrock => foundations}/src/security/common_syscall_allow_lists.rs (100%) rename {bedrock => foundations}/src/security/include/sys-deps.h (100%) rename {bedrock => foundations}/src/security/internal.rs (100%) rename {bedrock => foundations}/src/security/libseccomp (100%) rename {bedrock => foundations}/src/security/mod.rs (94%) rename {bedrock => foundations}/src/security/syscalls/aarch64.rs (100%) rename {bedrock => foundations}/src/security/syscalls/mod.rs (100%) rename {bedrock => foundations}/src/security/syscalls/x86_64.rs (100%) rename {bedrock => foundations}/src/settings/basic_impls.rs (100%) rename {bedrock => foundations}/src/settings/collections.rs (100%) rename {bedrock => foundations}/src/settings/mod.rs (88%) rename {bedrock => foundations}/src/settings/net.rs (100%) rename {bedrock => foundations}/src/telemetry/log/field_dedup.rs (98%) rename {bedrock => foundations}/src/telemetry/log/field_filtering.rs (100%) rename {bedrock => foundations}/src/telemetry/log/field_redact.rs (98%) rename {bedrock => foundations}/src/telemetry/log/init.rs (100%) rename {bedrock => foundations}/src/telemetry/log/internal.rs (100%) rename {bedrock => foundations}/src/telemetry/log/log_volume.rs (86%) rename {bedrock => foundations}/src/telemetry/log/mod.rs (92%) rename {bedrock => foundations}/src/telemetry/log/rate_limit.rs (100%) rename {bedrock => foundations}/src/telemetry/log/testing.rs (100%) rename {bedrock => foundations}/src/telemetry/memory_profiler.rs (97%) rename {bedrock => foundations}/src/telemetry/metrics/init.rs (100%) rename {bedrock => foundations}/src/telemetry/metrics/internal.rs (100%) rename {bedrock => foundations}/src/telemetry/metrics/mod.rs (91%) rename {bedrock => foundations}/src/telemetry/mod.rs (93%) rename {bedrock => foundations}/src/telemetry/scope.rs (100%) rename {bedrock => foundations}/src/telemetry/server.rs (100%) rename {bedrock => foundations}/src/telemetry/settings/logging.rs (97%) rename {bedrock => foundations}/src/telemetry/settings/memory_profiler.rs (100%) rename {bedrock => foundations}/src/telemetry/settings/metrics.rs (100%) rename {bedrock => foundations}/src/telemetry/settings/mod.rs (100%) rename {bedrock => foundations}/src/telemetry/settings/rate_limit.rs (100%) rename {bedrock => foundations}/src/telemetry/settings/server.rs (100%) rename {bedrock => foundations}/src/telemetry/settings/tracing.rs (100%) rename {bedrock => foundations}/src/telemetry/testing.rs (100%) rename {bedrock => foundations}/src/telemetry/tracing/init.rs (100%) rename {bedrock => foundations}/src/telemetry/tracing/internal.rs (100%) rename {bedrock => foundations}/src/telemetry/tracing/mod.rs (92%) rename {bedrock => foundations}/src/telemetry/tracing/rate_limit.rs (100%) rename {bedrock => foundations}/src/telemetry/tracing/testing.rs (98%) rename {bedrock => foundations}/src/utils.rs (100%) rename {bedrock => foundations}/tests/data/settings_complex.yaml (100%) rename {bedrock => foundations}/tests/data/settings_enum_fields.yaml (100%) rename {bedrock => foundations}/tests/data/settings_nested_duplicate_field.yaml (100%) rename {bedrock => foundations}/tests/data/settings_nested_struct.yaml (100%) rename {bedrock => foundations}/tests/data/settings_simple_config_with_docs.yaml (100%) rename {bedrock => foundations}/tests/data/with_map.yaml (100%) rename {bedrock => foundations}/tests/data/with_option_none.yaml (100%) rename {bedrock => foundations}/tests/data/with_option_some.yaml (100%) rename {bedrock => foundations}/tests/logging.rs (69%) rename {bedrock => foundations}/tests/settings.rs (94%) rename {bedrock => foundations}/tests/telemetry_server.rs (87%) rename {bedrock => foundations}/tests/tracing.rs (77%) rename {bedrock => foundations}/tests/with_test_telemetry.rs (84%) diff --git a/.gitmodules b/.gitmodules index bde2928..849a718 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "bedrock/src/security/libseccomp"] - path = bedrock/src/security/libseccomp +[submodule "foundations/src/security/libseccomp"] + path = foundations/src/security/libseccomp url = https://github.com/seccomp/libseccomp.git diff --git a/Cargo.toml b/Cargo.toml index 6d581e8..c19536b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ - "bedrock", - "bedrock-macros", + "foundations", + "foundations-macros", "examples", "tools/gen-syscall-enum" ] @@ -9,7 +9,7 @@ resolver = "2" [workspace.package] version = "2.2.0" -repository = "https://bitbucket.cfdata.org/projects/OXY/repos/bedrock" +repository = "https://bitbucket.cfdata.org/projects/OXY/repos/foundations" edition = "2021" authors = ["Cloudflare"] @@ -24,8 +24,8 @@ debug = 1 [workspace.dependencies] anyhow = "1.0.75" -bedrock = { version = "2", path = "./bedrock" } -bedrock-macros = { version = "2", path = "./bedrock-macros" } +foundations = { version = "2", path = "./foundations" } +foundations-macros = { version = "2", path = "./foundations-macros" } bindgen = { version = "0.68.1", default-features = false } cc = "1.0" clap = "4.4" @@ -34,8 +34,9 @@ darling = "0.14" erased-serde = "0.3.28" futures-util = "0.3.28" governor = "0.6" -hyper = { version = "0.14.27", default-features = false } +hyper = { version = "0.14", default-features = false } indexmap = "2.0.0" +ipnetwork = "0.20" once_cell = "1.5" parking_lot = "0.12" proc-macro2 = { version = "1", default-features = false } diff --git a/README.md b/README.md index bce3ef7..45e07a7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Bedrock +# Foundations

- + banner

-Bedrock is a foundational Rust library, designed to help scale programs for distributed, +Foundations is a foundational Rust library, designed to help scale programs for distributed, production-grade systems. It enables engineers to concentrate on the core business logic of their services, rather than the intricacies of production operation setups. @@ -20,11 +20,11 @@ If you need any of those: * service configuration with documentation * CLI helper that takes care of the configuration loading -then Bedrock is a tool of choice for you. +then Foundations is a tool of choice for you. ## Documentation -https://docs.rs/bedrock/ +https://docs.rs/foundations/ ## License diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 5d60408..783d510 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -5,7 +5,7 @@ - 2024-01-02 OXY-1298: Disable MacOS build due to errors - 2023-12-21 Add PID to root logger - 2023-12-12 Drop zero histogram bucket -- 2023-11-30 TUN-8005: Document how to use jemalloc from bedrock +- 2023-11-30 TUN-8005: Document how to use jemalloc from foundations 2.1.0 - 2023-10-13 Release 2.1.0 @@ -66,7 +66,7 @@ 1.2.0 - 2023-08-29 Release 1.2.0 -- 2023-06-16 ROCK-4: Implement bedrock::telemetry::metrics +- 2023-06-16 ROCK-4: Implement foundations::telemetry::metrics - 2023-08-29 Remove unnecessary cast - 2023-08-23 ZTC-885: Updates heap profiling code slightly to be usable by oxy - 2023-06-19 Fix unused_variables lint @@ -116,7 +116,7 @@ - 2023-05-20 ROCK-9, ROCK-13 Part 1: Add the rest of the tracing API and document telemetry - 2023-05-12 Move settings macro into the settings module - 2023-05-12 ROCK-9, ROCK-10 Implement tracing internals and testing -- 2023-05-11 GATE-4093: change bedrock package version to use the standard indexed field +- 2023-05-11 GATE-4093: change foundations package version to use the standard indexed field - 2023-05-04 ROCK-2 Implement logging - 2023-05-02 Get rid of owned keys feature in slog to not introduce breaking changes - 2023-05-02 ROCK-11 Add toggle to disable Debug impl in Settings macro diff --git a/examples/Cargo.toml b/examples/Cargo.toml index b13677b..9001bcb 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dev-dependencies] anyhow = { workspace = true } -bedrock = { workspace = true } +foundations = { workspace = true } futures-util = { workspace = true } hyper = { workspace = true } tokio = { workspace = true } diff --git a/examples/http_server/main.rs b/examples/http_server/main.rs index 5551b45..721c4ae 100644 --- a/examples/http_server/main.rs +++ b/examples/http_server/main.rs @@ -13,10 +13,10 @@ mod settings; use self::settings::{EndpointSettings, HttpServerSettings, ResponseSettings}; use anyhow::anyhow; -use bedrock::cli::{Arg, ArgAction, Cli}; -use bedrock::settings::collections::Map; -use bedrock::telemetry::{init_with_server, log, tracing, TelemetryContext}; -use bedrock::BootstrapResult; +use foundations::cli::{Arg, ArgAction, Cli}; +use foundations::settings::collections::Map; +use foundations::telemetry::{init_with_server, log, tracing, TelemetryContext}; +use foundations::BootstrapResult; use futures_util::stream::{FuturesUnordered, StreamExt}; use hyper::server::conn::Http; use hyper::service::service_fn; @@ -29,7 +29,7 @@ use tokio::net::{TcpListener, TcpStream}; #[tokio::main] async fn main() -> BootstrapResult<()> { // Obtain service information from Cargo.toml - let service_info = bedrock::service_info!(); + let service_info = foundations::service_info!(); // Parse command line arguments. Add additional command line option that allows checking // the config without running the server. @@ -237,8 +237,10 @@ async fn respond( #[cfg(target_os = "linux")] fn sandbox_syscalls() -> BootstrapResult<()> { - use bedrock::security::common_syscall_allow_lists::{ASYNC, NET_SOCKET_API, SERVICE_BASICS}; - use bedrock::security::{allow_list, enable_syscall_sandboxing, ViolationAction}; + use foundations::security::common_syscall_allow_lists::{ + ASYNC, NET_SOCKET_API, SERVICE_BASICS, + }; + use foundations::security::{allow_list, enable_syscall_sandboxing, ViolationAction}; allow_list! { static ALLOWED = [ diff --git a/examples/http_server/metrics.rs b/examples/http_server/metrics.rs index 146df42..05aa9d9 100644 --- a/examples/http_server/metrics.rs +++ b/examples/http_server/metrics.rs @@ -1,4 +1,4 @@ -use bedrock::telemetry::metrics::{metrics, Counter, Gauge}; +use foundations::telemetry::metrics::{metrics, Counter, Gauge}; use std::sync::Arc; #[metrics] diff --git a/examples/http_server/settings.rs b/examples/http_server/settings.rs index 36ca248..f31a7a6 100644 --- a/examples/http_server/settings.rs +++ b/examples/http_server/settings.rs @@ -7,10 +7,10 @@ //! //! `examples/http_server/example_conf.yaml` file included in the repo shows generated default //! config. -use bedrock::settings::collections::Map; -use bedrock::settings::net::SocketAddr; -use bedrock::settings::settings; -use bedrock::telemetry::settings::TelemetrySettings; +use foundations::settings::collections::Map; +use foundations::settings::net::SocketAddr; +use foundations::settings::settings; +use foundations::telemetry::settings::TelemetrySettings; #[settings] pub(crate) struct HttpServerSettings { diff --git a/bedrock-macros/Cargo.toml b/foundations-macros/Cargo.toml similarity index 80% rename from bedrock-macros/Cargo.toml rename to foundations-macros/Cargo.toml index 9113938..8121765 100644 --- a/bedrock-macros/Cargo.toml +++ b/foundations-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "bedrock-macros" -description = "Procedural macros used by bedrock." +name = "foundations-macros" +description = "Procedural macros used by foundations." version = { workspace = true } edition = { workspace = true } repository = { workspace = true } diff --git a/bedrock-macros/src/common.rs b/foundations-macros/src/common.rs similarity index 100% rename from bedrock-macros/src/common.rs rename to foundations-macros/src/common.rs diff --git a/bedrock-macros/src/info_metric/mod.rs b/foundations-macros/src/info_metric/mod.rs similarity index 91% rename from bedrock-macros/src/info_metric/mod.rs rename to foundations-macros/src/info_metric/mod.rs index abf2e19..8666392 100644 --- a/bedrock-macros/src/info_metric/mod.rs +++ b/foundations-macros/src/info_metric/mod.rs @@ -30,7 +30,7 @@ impl Default for MacroArgs { impl MacroArgs { fn default_crate_path() -> Path { - parse_quote!(::bedrock) + parse_quote!(::foundations) } } @@ -76,7 +76,7 @@ pub(crate) fn expand(args: TokenStream, item: TokenStream) -> TokenStream { fn expand_from_parsed(args: MacroArgs, struct_: Struct) -> Result { let MacroArgs { - crate_path: bedrock, + crate_path: foundations, name: metric_name, } = args; @@ -90,7 +90,7 @@ fn expand_from_parsed(args: MacroArgs, struct_: Struct) -> Result Result Result Path { - parse_quote!(::bedrock) + parse_quote!(::foundations) } } @@ -88,7 +88,7 @@ pub(crate) fn expand(args: TokenStream, item: TokenStream) -> TokenStream { fn expand_from_parsed(args: MacroArgs, extern_: Mod) -> proc_macro2::TokenStream { let MacroArgs { - crate_path: bedrock, + crate_path: foundations, } = &args; let Mod { @@ -99,20 +99,22 @@ fn expand_from_parsed(args: MacroArgs, extern_: Mod) -> proc_macro2::TokenStream fns, } = extern_; - let reexports = quote! { #bedrock::reexports_for_macros }; + let reexports = quote! { #foundations::reexports_for_macros }; // This should be using `Span::def_site` but it is currently unstable. let metrics_struct = Ident::new(&format!("__{mod_name}_Metrics"), Span::call_site()); - let metric_fields = fns.iter().map(|fn_| metric_field(bedrock, fn_)); - let label_set_structs = fns.iter().filter_map(|fn_| label_set_struct(bedrock, fn_)); + let metric_fields = fns.iter().map(|fn_| metric_field(foundations, fn_)); + let label_set_structs = fns + .iter() + .filter_map(|fn_| label_set_struct(foundations, fn_)); let registry_init = |var: &str, kind: &str| { let var = Ident::new(var, Span::call_site()); let method = Ident::new(&format!("get_{kind}_subsystem"), Span::call_site()); quote! { - let #var = &mut *#bedrock::telemetry::metrics::internal::Registries::#method(stringify!(#mod_name)); + let #var = &mut *#foundations::telemetry::metrics::internal::Registries::#method(stringify!(#mod_name)); } }; @@ -126,11 +128,11 @@ fn expand_from_parsed(args: MacroArgs, extern_: Mod) -> proc_macro2::TokenStream .any(|fn_| fn_.attrs.optional) .then(|| registry_init("opt_registry", "opt")); - let metric_inits = fns.iter().map(|fn_| metric_init(bedrock, fn_)); + let metric_inits = fns.iter().map(|fn_| metric_init(foundations, fn_)); let metric_fns = fns .iter() - .map(|fn_| metric_fn(bedrock, &metrics_struct, fn_)); + .map(|fn_| metric_fn(foundations, &metrics_struct, fn_)); quote! { #(#mod_attrs)* #mod_vis #mod_token #mod_name { @@ -160,7 +162,7 @@ fn expand_from_parsed(args: MacroArgs, extern_: Mod) -> proc_macro2::TokenStream } /// Gets the type of the metric for its field in metric struct. -fn metric_field(bedrock: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { +fn metric_field(foundations: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { let ItemFn { attrs: FnAttrs { cfg, ctor, .. }, args, @@ -176,7 +178,7 @@ fn metric_field(bedrock: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { }) = ctor { quote! { - #bedrock::reexports_for_macros::prometools::serde::Family< + #foundations::reexports_for_macros::prometools::serde::Family< #metric_name, #metric_ty, #ctor_path, @@ -184,7 +186,7 @@ fn metric_field(bedrock: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { } } else { quote! { - #bedrock::reexports_for_macros::prometools::serde::Family< + #foundations::reexports_for_macros::prometools::serde::Family< #metric_name, #metric_ty, > @@ -195,7 +197,7 @@ fn metric_field(bedrock: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { } /// Returns the definition for the label set struct, if this metric uses labels. -fn label_set_struct(bedrock: &Path, fn_: &ItemFn) -> Option { +fn label_set_struct(foundations: &Path, fn_: &ItemFn) -> Option { let ItemFn { attrs: FnAttrs { cfg, .. }, args, @@ -207,7 +209,7 @@ fn label_set_struct(bedrock: &Path, fn_: &ItemFn) -> Option Option Option proc_macro2::TokenStream { +fn metric_init(foundations: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { let ItemFn { attrs: FnAttrs { @@ -270,7 +272,7 @@ fn metric_init(bedrock: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { .. } = fn_; - let reexports = quote! { #bedrock::reexports_for_macros }; + let reexports = quote! { #foundations::reexports_for_macros }; let registry = Ident::new( if *optional { "opt_registry" @@ -307,7 +309,7 @@ fn metric_init(bedrock: &Path, fn_: &ItemFn) -> proc_macro2::TokenStream { } } -fn metric_fn(bedrock: &Path, metrics_struct: &Ident, fn_: &ItemFn) -> proc_macro2::TokenStream { +fn metric_fn(foundations: &Path, metrics_struct: &Ident, fn_: &ItemFn) -> proc_macro2::TokenStream { let ItemFn { attrs: FnAttrs { cfg, doc, .. }, fn_token, @@ -355,7 +357,7 @@ fn metric_fn(bedrock: &Path, metrics_struct: &Ident, fn_: &ItemFn) -> proc_macro quote! { ::std::clone::Clone::clone( - &#bedrock::reexports_for_macros::prometools::serde::Family::get_or_create( + &#foundations::reexports_for_macros::prometools::serde::Family::get_or_create( &#metrics_struct.#metric_name, &#metric_name { #(#label_inits,)* @@ -403,8 +405,8 @@ mod tests { struct __empty_Metrics {} #[allow(non_upper_case_globals)] - static __empty_Metrics: ::bedrock::reexports_for_macros::once_cell::sync::Lazy<__empty_Metrics> = - ::bedrock::reexports_for_macros::once_cell::sync::Lazy::new(|| { __empty_Metrics {} }); + static __empty_Metrics: ::foundations::reexports_for_macros::once_cell::sync::Lazy<__empty_Metrics> = + ::foundations::reexports_for_macros::once_cell::sync::Lazy::new(|| { __empty_Metrics {} }); } }; @@ -495,15 +497,15 @@ mod tests { } #[allow(non_upper_case_globals)] - static __oxy_Metrics: ::bedrock::reexports_for_macros::once_cell::sync::Lazy<__oxy_Metrics> = - ::bedrock::reexports_for_macros::once_cell::sync::Lazy::new(|| { - let opt_registry = &mut *::bedrock::telemetry::metrics::internal::Registries::get_opt_subsystem(stringify!(oxy)); + static __oxy_Metrics: ::foundations::reexports_for_macros::once_cell::sync::Lazy<__oxy_Metrics> = + ::foundations::reexports_for_macros::once_cell::sync::Lazy::new(|| { + let opt_registry = &mut *::foundations::telemetry::metrics::internal::Registries::get_opt_subsystem(stringify!(oxy)); __oxy_Metrics { connections_total: { let metric = ::std::default::Default::default(); - ::bedrock::reexports_for_macros::prometheus_client::registry::Registry::register( + ::foundations::reexports_for_macros::prometheus_client::registry::Registry::register( opt_registry, ::std::stringify!(connections_total), str::trim(" Total number of connections"), @@ -555,22 +557,22 @@ mod tests { #[allow(non_camel_case_types)] struct __oxy_Metrics { connections_errors_total: - ::bedrock::reexports_for_macros::prometools::serde::Family< + ::foundations::reexports_for_macros::prometools::serde::Family< connections_errors_total, Counter, >, } #[allow(non_camel_case_types)] - #[::bedrock::reexports_for_macros::serde_with::serde_as(crate = ":: bedrock :: reexports_for_macros :: serde_with")] + #[::foundations::reexports_for_macros::serde_with::serde_as(crate = ":: foundations :: reexports_for_macros :: serde_with")] #[derive( ::std::clone::Clone, ::std::cmp::Eq, ::std::hash::Hash, ::std::cmp::PartialEq, - ::bedrock::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Serialize, )] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] struct connections_errors_total { #[serde(rename = "endpoint_name")] endpoint: Arc, @@ -581,15 +583,15 @@ mod tests { } #[allow(non_upper_case_globals)] - static __oxy_Metrics: ::bedrock::reexports_for_macros::once_cell::sync::Lazy<__oxy_Metrics> = - ::bedrock::reexports_for_macros::once_cell::sync::Lazy::new(|| { - let registry = &mut *::bedrock::telemetry::metrics::internal::Registries::get_main_subsystem(stringify!(oxy)); + static __oxy_Metrics: ::foundations::reexports_for_macros::once_cell::sync::Lazy<__oxy_Metrics> = + ::foundations::reexports_for_macros::once_cell::sync::Lazy::new(|| { + let registry = &mut *::foundations::telemetry::metrics::internal::Registries::get_main_subsystem(stringify!(oxy)); __oxy_Metrics { connections_errors_total: { let metric = ::std::default::Default::default(); - ::bedrock::reexports_for_macros::prometheus_client::registry::Registry::register( + ::foundations::reexports_for_macros::prometheus_client::registry::Registry::register( registry, ::std::stringify!(connections_errors_total), str::trim(" Total number of connection errors"), @@ -610,7 +612,7 @@ mod tests { error: impl Into, ) -> Counter { ::std::clone::Clone::clone( - &::bedrock::reexports_for_macros::prometools::serde::Family::get_or_create( + &::foundations::reexports_for_macros::prometools::serde::Family::get_or_create( &__oxy_Metrics.connections_errors_total, &connections_errors_total { endpoint: ::std::clone::Clone::clone(endpoint), @@ -655,7 +657,7 @@ mod tests { struct __oxy_Metrics { connections_latency: Histogram, requests_per_connection: - ::bedrock::reexports_for_macros::prometools::serde::Family< + ::foundations::reexports_for_macros::prometools::serde::Family< requests_per_connection, Histogram, HistogramBuilder, @@ -668,25 +670,25 @@ mod tests { ::std::cmp::Eq, ::std::hash::Hash, ::std::cmp::PartialEq, - ::bedrock::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Serialize, )] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] struct requests_per_connection { endpoint: String, } #[allow(non_upper_case_globals)] - static __oxy_Metrics: ::bedrock::reexports_for_macros::once_cell::sync::Lazy<__oxy_Metrics> = - ::bedrock::reexports_for_macros::once_cell::sync::Lazy::new(|| { - let registry = &mut *::bedrock::telemetry::metrics::internal::Registries::get_main_subsystem(stringify!(oxy)); + static __oxy_Metrics: ::foundations::reexports_for_macros::once_cell::sync::Lazy<__oxy_Metrics> = + ::foundations::reexports_for_macros::once_cell::sync::Lazy::new(|| { + let registry = &mut *::foundations::telemetry::metrics::internal::Registries::get_main_subsystem(stringify!(oxy)); __oxy_Metrics { connections_latency: { - let metric = ::bedrock::reexports_for_macros::prometheus_client::metrics::family::MetricConstructor::new_metric( + let metric = ::foundations::reexports_for_macros::prometheus_client::metrics::family::MetricConstructor::new_metric( &(HistogramBuilder { buckets: &[0.5, 1.] }) ); - ::bedrock::reexports_for_macros::prometheus_client::registry::Registry::register( + ::foundations::reexports_for_macros::prometheus_client::registry::Registry::register( registry, ::std::stringify!(connections_latency), str::trim(" Latency of connections"), @@ -696,11 +698,11 @@ mod tests { metric }, requests_per_connection: { - let metric = ::bedrock::reexports_for_macros::prometools::serde::Family::new_with_constructor( + let metric = ::foundations::reexports_for_macros::prometools::serde::Family::new_with_constructor( HistogramBuilder { buckets: &[2., 3.] } ); - ::bedrock::reexports_for_macros::prometheus_client::registry::Registry::register( + ::foundations::reexports_for_macros::prometheus_client::registry::Registry::register( registry, ::std::stringify!(requests_per_connection), str::trim(" Number of requests per connection"), @@ -724,7 +726,7 @@ mod tests { endpoint: String, ) -> Histogram { ::std::clone::Clone::clone( - &::bedrock::reexports_for_macros::prometools::serde::Family::get_or_create( + &::foundations::reexports_for_macros::prometools::serde::Family::get_or_create( &__oxy_Metrics.requests_per_connection, &requests_per_connection { endpoint, diff --git a/bedrock-macros/src/metrics/parsing.rs b/foundations-macros/src/metrics/parsing.rs similarity index 100% rename from bedrock-macros/src/metrics/parsing.rs rename to foundations-macros/src/metrics/parsing.rs diff --git a/bedrock-macros/src/settings.rs b/foundations-macros/src/settings.rs similarity index 87% rename from bedrock-macros/src/settings.rs rename to foundations-macros/src/settings.rs index 1163b82..2aef1e3 100644 --- a/bedrock-macros/src/settings.rs +++ b/foundations-macros/src/settings.rs @@ -38,7 +38,7 @@ impl Options { } fn default_crate_path() -> Path { - parse_quote!(::bedrock) + parse_quote!(::foundations) } } @@ -356,11 +356,11 @@ mod tests { let expected = code_str! { #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] #[serde(default)] struct TestStruct { #[doc = r" A boolean value."] @@ -369,7 +369,7 @@ mod tests { integer: i32, } - impl ::bedrock::settings::Settings for TestStruct { + impl ::foundations::settings::Settings for TestStruct { fn add_docs( &self, parent_key: &[String], @@ -377,11 +377,11 @@ mod tests { ) { let mut key = parent_key.to_vec(); key.push("boolean".into()); - ::bedrock::settings::Settings::add_docs(&self.boolean, &key, docs); + ::foundations::settings::Settings::add_docs(&self.boolean, &key, docs); docs.insert(key, &[r" A boolean value.",][..]); let mut key = parent_key.to_vec(); key.push("integer".into()); - ::bedrock::settings::Settings::add_docs(&self.integer, &key, docs); + ::foundations::settings::Settings::add_docs(&self.integer, &key, docs); docs.insert(key, &[r" An integer value.",][..]); } } @@ -423,11 +423,11 @@ mod tests { let expected = code_str! { #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] #[serde(default)] struct TestStruct { #[doc = r" A boolean value."] @@ -439,7 +439,7 @@ mod tests { integer: i32, } - impl ::bedrock::settings::Settings for TestStruct { + impl ::foundations::settings::Settings for TestStruct { fn add_docs( &self, parent_key: &[String], @@ -449,7 +449,7 @@ mod tests { { let mut key = parent_key.to_vec(); key.push("boolean".into()); - ::bedrock::settings::Settings::add_docs(&self.boolean, &key, docs); + ::foundations::settings::Settings::add_docs(&self.boolean, &key, docs); docs.insert(key, &[r" A boolean value.",][..]); } #[cfg(test)] @@ -457,7 +457,7 @@ mod tests { { let mut key = parent_key.to_vec(); key.push("integer".into()); - ::bedrock::settings::Settings::add_docs(&self.integer, &key, docs); + ::foundations::settings::Settings::add_docs(&self.integer, &key, docs); docs.insert(key, &[r" An integer value.",][..]); } } @@ -564,11 +564,11 @@ mod tests { let expected = code_str! { #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] #[serde(default)] struct TestStruct { #[doc = r" A boolean value."] @@ -577,7 +577,7 @@ mod tests { integer: i32, } - impl ::bedrock::settings::Settings for TestStruct { + impl ::foundations::settings::Settings for TestStruct { fn add_docs( &self, parent_key: &[String], @@ -585,11 +585,11 @@ mod tests { ) { let mut key = parent_key.to_vec(); key.push("boolean".into()); - ::bedrock::settings::Settings::add_docs(&self.boolean, &key, docs); + ::foundations::settings::Settings::add_docs(&self.boolean, &key, docs); docs.insert(key, &[r" A boolean value.",][..]); let mut key = parent_key.to_vec(); key.push("integer".into()); - ::bedrock::settings::Settings::add_docs(&self.integer, &key, docs); + ::foundations::settings::Settings::add_docs(&self.integer, &key, docs); docs.insert(key, &[r" An integer value.",][..]); } } @@ -614,14 +614,14 @@ mod tests { #[derive(Default)] #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] struct TestStruct(u64); - impl ::bedrock::settings::Settings for TestStruct { } + impl ::foundations::settings::Settings for TestStruct { } }; assert_eq!(actual, expected); @@ -643,13 +643,13 @@ mod tests { #[derive(Default)] #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] struct TestStruct(u64); - impl ::bedrock::settings::Settings for TestStruct { } + impl ::foundations::settings::Settings for TestStruct { } }; assert_eq!(actual, expected); @@ -670,14 +670,14 @@ mod tests { let expected = code_str! { #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] struct TestStruct(u64); - impl ::bedrock::settings::Settings for TestStruct { } + impl ::foundations::settings::Settings for TestStruct { } }; assert_eq!(actual, expected); @@ -703,11 +703,11 @@ mod tests { #[derive(Default)] #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] #[serde(rename_all="snake_case")] enum TestEnum { #[default] @@ -715,7 +715,7 @@ mod tests { NewTypeVariant(String) } - impl ::bedrock::settings::Settings for TestEnum { } + impl ::foundations::settings::Settings for TestEnum { } }; assert_eq!(actual, expected); @@ -739,18 +739,18 @@ mod tests { let expected = code_str! { #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] #[serde(rename_all="snake_case")] enum TestEnum { UnitVariant, NewTypeVariant(String) } - impl ::bedrock::settings::Settings for TestEnum { } + impl ::foundations::settings::Settings for TestEnum { } }; assert_eq!(actual, expected); @@ -845,11 +845,11 @@ mod tests { let expected = code_str! { #[derive( Clone, - ::bedrock::reexports_for_macros::serde::Serialize, - ::bedrock::reexports_for_macros::serde::Deserialize, + ::foundations::reexports_for_macros::serde::Serialize, + ::foundations::reexports_for_macros::serde::Deserialize, )] #[derive(Debug)] - #[serde(crate = ":: bedrock :: reexports_for_macros :: serde")] + #[serde(crate = ":: foundations :: reexports_for_macros :: serde")] #[serde(default)] struct TestStruct { #[serde(default = "TestStruct::default_boolean")] @@ -858,7 +858,7 @@ mod tests { integer: i32, } - impl ::bedrock::settings::Settings for TestStruct { + impl ::foundations::settings::Settings for TestStruct { fn add_docs( &self, parent_key: &[String], @@ -866,10 +866,10 @@ mod tests { ) { let mut key = parent_key.to_vec(); key.push("boolean".into()); - ::bedrock::settings::Settings::add_docs(&self.boolean, &key, docs); + ::foundations::settings::Settings::add_docs(&self.boolean, &key, docs); let mut key = parent_key.to_vec(); key.push("integer".into()); - ::bedrock::settings::Settings::add_docs(&self.integer, &key, docs); + ::foundations::settings::Settings::add_docs(&self.integer, &key, docs); } } diff --git a/bedrock-macros/src/span_fn.rs b/foundations-macros/src/span_fn.rs similarity index 96% rename from bedrock-macros/src/span_fn.rs rename to foundations-macros/src/span_fn.rs index f1b3a6f..38068e3 100644 --- a/bedrock-macros/src/span_fn.rs +++ b/foundations-macros/src/span_fn.rs @@ -45,7 +45,7 @@ struct Options { impl Options { fn default_crate_path() -> Path { - parse_quote!(::bedrock) + parse_quote!(::foundations) } } @@ -201,7 +201,7 @@ mod tests { let expected = code_str! { fn do_sync<>() -> io::Result { - let __span = ::bedrock::telemetry::tracing::span("sync_span"); + let __span = ::foundations::telemetry::tracing::span("sync_span"); { do_something_else(); @@ -231,7 +231,7 @@ mod tests { let expected = code_str! { fn do_sync<>() -> io::Result { - let __span = ::bedrock::telemetry::tracing::span(some::module::SYNC_SPAN); + let __span = ::foundations::telemetry::tracing::span(some::module::SYNC_SPAN); { do_something_else(); @@ -261,7 +261,7 @@ mod tests { let expected = code_str! { async fn do_async<>() -> io::Result { - ::bedrock::telemetry::TelemetryContext::current().apply_with_tracing_span( + ::foundations::telemetry::TelemetryContext::current().apply_with_tracing_span( "async_span", async move {{ do_something_else().await; @@ -319,7 +319,7 @@ mod tests { Self: 'async_trait, { Box::pin(async move { - ::bedrock::telemetry::TelemetryContext::current().apply_with_tracing_span( + ::foundations::telemetry::TelemetryContext::current().apply_with_tracing_span( "async_trait_span", async move { if let ::core::option::Option::Some(__ret) = ::core::option::Option::None:: { diff --git a/bedrock-macros/src/with_test_telemetry.rs b/foundations-macros/src/with_test_telemetry.rs similarity index 96% rename from bedrock-macros/src/with_test_telemetry.rs rename to foundations-macros/src/with_test_telemetry.rs index 2fabd54..873b71c 100644 --- a/bedrock-macros/src/with_test_telemetry.rs +++ b/foundations-macros/src/with_test_telemetry.rs @@ -17,7 +17,7 @@ struct Options { impl Options { fn default_crate_path() -> Path { - parse_quote!(::bedrock) + parse_quote!(::foundations) } } @@ -144,7 +144,7 @@ mod tests { assert!(false); } - let __ctx = ::bedrock::telemetry::TelemetryContext::test(); + let __ctx = ::foundations::telemetry::TelemetryContext::test(); __ctx.clone().apply(async move { __some_test(__ctx).await; }).await; } @@ -174,7 +174,7 @@ mod tests { assert!(false); } - let __ctx = ::bedrock::telemetry::TelemetryContext::test(); + let __ctx = ::foundations::telemetry::TelemetryContext::test(); let __scope = __ctx.scope(); __some_test(__ctx); diff --git a/bedrock/Cargo.toml b/foundations/Cargo.toml similarity index 95% rename from bedrock/Cargo.toml rename to foundations/Cargo.toml index bd9a698..08930f9 100644 --- a/bedrock/Cargo.toml +++ b/foundations/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bedrock" +name = "foundations" description = "A Rust service foundation framework." version = { workspace = true } edition = { workspace = true } @@ -34,7 +34,7 @@ platform-common-default = [ # Enables metrics functionality. metrics = [ - "dep:bedrock-macros", + "dep:foundations-macros", "dep:erased-serde", "dep:once_cell", "dep:parking_lot", @@ -47,7 +47,7 @@ metrics = [ # Enables serializable documented settings functionality. settings = [ - "dep:bedrock-macros", + "dep:foundations-macros", "dep:serde_path_to_error", "dep:serde_yaml", "dep:serde", @@ -86,7 +86,7 @@ logging = [ # Enables distributed tracing functionality. tracing = [ - "dep:bedrock-macros", + "dep:foundations-macros", "dep:crossbeam-channel", "dep:governor", "dep:once_cell", @@ -126,7 +126,7 @@ cli = [ # Enables testing-related functionality. testing = [ - "dep:bedrock-macros" + "dep:foundations-macros" ] [package.metadata.docs.rs] @@ -135,7 +135,7 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] anyhow = { workspace = true, features = ["backtrace", "std"] } -bedrock-macros = { workspace = true, optional = true } +foundations-macros = { workspace = true, optional = true } crossbeam-channel = { workspace = true, optional = true } erased-serde = { workspace = true, optional = true } clap = { workspace = true, optional = true } @@ -174,6 +174,7 @@ tempfile = { workspace = true, optional = true } reqwest = { workspace = true } serde = { workspace = true, features = ["rc"] } tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } +ipnetwork = { workspace = true } [build-dependencies] bindgen = { workspace = true, features = ["runtime"], optional = true } diff --git a/bedrock/build.rs b/foundations/build.rs similarity index 100% rename from bedrock/build.rs rename to foundations/build.rs diff --git a/bedrock/src/cli.rs b/foundations/src/cli.rs similarity index 97% rename from bedrock/src/cli.rs rename to foundations/src/cli.rs index 61225c2..f85315d 100644 --- a/bedrock/src/cli.rs +++ b/foundations/src/cli.rs @@ -15,7 +15,7 @@ const USE_CONFIG_OPT_ID: &str = "config"; /// A command line interface (CLI) helper that takes care of the command line arguments parsing /// basics. /// -/// Bedrock-based services are expected to primarily use [`Settings`] for its configuration. This +/// Foundations-based services are expected to primarily use [`Settings`] for its configuration. This /// helper takes care of setting up CLI with the provided [`ServiceInfo`] and service configuration /// parsing. /// diff --git a/bedrock/src/lib.rs b/foundations/src/lib.rs similarity index 91% rename from bedrock/src/lib.rs rename to foundations/src/lib.rs index 5024523..3a66427 100644 --- a/bedrock/src/lib.rs +++ b/foundations/src/lib.rs @@ -1,4 +1,4 @@ -//! Bedrock is a modular foundation for production-ready services implemented in Rust. +//! Foundations is a modular foundation for production-ready services implemented in Rust. //! //! If you need any of those: //! @@ -10,12 +10,12 @@ //! * service configuration with documentation //! * CLI helper that takes care of the configuration loading //! -//! then Bedrock is a tool of choice for you. +//! then Foundations is a tool of choice for you. //! //! Check out [examples] for an example of how all these components can be used together. //! //! # Features -//! Bedrock can take of all aspects of service bootstrapping, but also can be used as a component +//! Foundations can take of all aspects of service bootstrapping, but also can be used as a component //! library in a modular fashion by enabling or disabling [Cargo features]: //! //! - **default**: All features are enabled by default. @@ -39,7 +39,7 @@ //! [Cargo features]: https://doc.rust-lang.org/stable/cargo/reference/features.html#the-features-section //! [seccomp]: https://en.wikipedia.org/wiki/Seccomp //! [jemalloc]: https://github.com/jemalloc/jemalloc -//! [examples]: https://github.com/cloudflare/bedrock/tree/main/examples +//! [examples]: https://github.com/cloudflare/foundations/tree/main/examples #![warn(missing_docs)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] @@ -93,8 +93,8 @@ pub mod reexports_for_macros { /// directly. If **jemalloc** feature is enabled then the service will use jemalloc for all the /// memory allocations implicitly. /// -/// If no Bedrock API is being used by your project, you will need to explicitly link bedrock crate -/// to your project by adding `extern crate bedrock;` to your `main.rs` or `lib.rs`, for jemalloc to +/// If no Foundations API is being used by your project, you will need to explicitly link foundations crate +/// to your project by adding `extern crate foundations;` to your `main.rs` or `lib.rs`, for jemalloc to /// be embedded in your binary. /// /// [jemalloc]: https://github.com/jemalloc/jemalloc diff --git a/bedrock/src/security/common_syscall_allow_lists.rs b/foundations/src/security/common_syscall_allow_lists.rs similarity index 100% rename from bedrock/src/security/common_syscall_allow_lists.rs rename to foundations/src/security/common_syscall_allow_lists.rs diff --git a/bedrock/src/security/include/sys-deps.h b/foundations/src/security/include/sys-deps.h similarity index 100% rename from bedrock/src/security/include/sys-deps.h rename to foundations/src/security/include/sys-deps.h diff --git a/bedrock/src/security/internal.rs b/foundations/src/security/internal.rs similarity index 100% rename from bedrock/src/security/internal.rs rename to foundations/src/security/internal.rs diff --git a/bedrock/src/security/libseccomp b/foundations/src/security/libseccomp similarity index 100% rename from bedrock/src/security/libseccomp rename to foundations/src/security/libseccomp diff --git a/bedrock/src/security/mod.rs b/foundations/src/security/mod.rs similarity index 94% rename from bedrock/src/security/mod.rs rename to foundations/src/security/mod.rs index 7abbf1b..657b5ef 100644 --- a/bedrock/src/security/mod.rs +++ b/foundations/src/security/mod.rs @@ -16,12 +16,12 @@ //! //! The crate provides a few [`common_syscall_allow_lists`] to simplify configuration. //! -//! bedrock compiles and statically links with [libseccomp], so it doesn't require the lib to be +//! foundations compiles and statically links with [libseccomp], so it doesn't require the lib to be //! installed. //! //! # Simple case [Spectre] mitigation for x86_64 processors //! -//! One of the simplest Spectre attack vectors it to use x86_64's [time stamp counter]. bedrock +//! One of the simplest Spectre attack vectors it to use x86_64's [time stamp counter]. foundations //! provides [`forbid_x86_64_cpu_cycle_counter`] method that dissallows the usage of the //! counter in the process, so any attempts to use the counter by malicious code will cause process //! termination. @@ -62,7 +62,7 @@ pub type RawOsErrorNum = u16; pub enum ViolationAction { /// Kill the process. /// - /// Note that even though seccomp API allows to kill individual threads, bedrock doesn't + /// Note that even though seccomp API allows to kill individual threads, foundations doesn't /// expose this action as killing threads without unwinding [can cause UB in Rust]. /// /// [can cause UB in Rust]: https://github.com/rust-lang/unsafe-code-guidelines/issues/211 @@ -187,10 +187,10 @@ pub enum Rule { /// Allow syscalls, required for [`std::process::exit`] to work, but allow only `0` status code, /// so this fails: /// ```should_panic - /// use bedrock::security::{ + /// use foundations::security::{ /// enable_syscall_sandboxing, ArgCmp, ViolationAction, Rule, Syscall, allow_list /// }; - /// use bedrock::security::common_syscall_allow_lists::RUST_BASICS; + /// use foundations::security::common_syscall_allow_lists::RUST_BASICS; /// use std::panic; /// use std::thread; /// use std::process; @@ -222,10 +222,10 @@ pub enum Rule { /// /// Same as the above but this time exit with `0` status code, so this works: /// ``` - /// use bedrock::security::{ + /// use foundations::security::{ /// enable_syscall_sandboxing, ArgCmp, ViolationAction, Rule, Syscall, allow_list /// }; - /// use bedrock::security::common_syscall_allow_lists::RUST_BASICS; + /// use foundations::security::common_syscall_allow_lists::RUST_BASICS; /// use std::panic; /// use std::thread; /// use std::process; @@ -271,10 +271,10 @@ pub enum Rule { /// # Examples /// /// ``` - /// use bedrock::security::{ + /// use foundations::security::{ /// enable_syscall_sandboxing, ViolationAction, allow_list, Rule, Syscall /// }; - /// use bedrock::security::common_syscall_allow_lists::{SERVICE_BASICS, NET_SOCKET_API}; + /// use foundations::security::common_syscall_allow_lists::{SERVICE_BASICS, NET_SOCKET_API}; /// use std::net::TcpListener; /// use std::panic; /// use std::thread; @@ -312,8 +312,8 @@ pub enum Rule { /// # Examples /// Forbid all the syscalls, so this fails: /// ```should_panic -/// use bedrock::security::{enable_syscall_sandboxing, ViolationAction, allow_list}; -/// use bedrock::security::common_syscall_allow_lists::SERVICE_BASICS; +/// use foundations::security::{enable_syscall_sandboxing, ViolationAction, allow_list}; +/// use foundations::security::common_syscall_allow_lists::SERVICE_BASICS; /// use std::net::TcpListener; /// use std::panic; /// use std::thread; @@ -325,8 +325,8 @@ pub enum Rule { /// /// Allow syscalls required for [`std::net::TcpListener::bind`] to work, so this works: /// ``` -/// use bedrock::security::{enable_syscall_sandboxing, ViolationAction, allow_list}; -/// use bedrock::security::common_syscall_allow_lists::SERVICE_BASICS; +/// use foundations::security::{enable_syscall_sandboxing, ViolationAction, allow_list}; +/// use foundations::security::common_syscall_allow_lists::SERVICE_BASICS; /// use std::net::TcpListener; /// use std::panic; /// use std::thread; @@ -411,7 +411,7 @@ pub fn enable_syscall_sandboxing( /// /// With forbidden timers the above code will fail to run: /// ```should_panic -/// bedrock::security::forbid_x86_64_cpu_cycle_counter(); +/// foundations::security::forbid_x86_64_cpu_cycle_counter(); /// /// let _ = unsafe { std::arch::x86_64::_rdtsc() } ; /// ``` @@ -443,8 +443,8 @@ pub fn forbid_x86_64_cpu_cycle_counter() { /// # Examples /// /// ``` -/// use bedrock::security::{allow_list, ArgCmp}; -/// use bedrock::security::common_syscall_allow_lists::RUST_BASICS; +/// use foundations::security::{allow_list, ArgCmp}; +/// use foundations::security::common_syscall_allow_lists::RUST_BASICS; /// /// allow_list! { /// pub static MY_ALLOW_LIST = [ diff --git a/bedrock/src/security/syscalls/aarch64.rs b/foundations/src/security/syscalls/aarch64.rs similarity index 100% rename from bedrock/src/security/syscalls/aarch64.rs rename to foundations/src/security/syscalls/aarch64.rs diff --git a/bedrock/src/security/syscalls/mod.rs b/foundations/src/security/syscalls/mod.rs similarity index 100% rename from bedrock/src/security/syscalls/mod.rs rename to foundations/src/security/syscalls/mod.rs diff --git a/bedrock/src/security/syscalls/x86_64.rs b/foundations/src/security/syscalls/x86_64.rs similarity index 100% rename from bedrock/src/security/syscalls/x86_64.rs rename to foundations/src/security/syscalls/x86_64.rs diff --git a/bedrock/src/settings/basic_impls.rs b/foundations/src/settings/basic_impls.rs similarity index 100% rename from bedrock/src/settings/basic_impls.rs rename to foundations/src/settings/basic_impls.rs diff --git a/bedrock/src/settings/collections.rs b/foundations/src/settings/collections.rs similarity index 100% rename from bedrock/src/settings/collections.rs rename to foundations/src/settings/collections.rs diff --git a/bedrock/src/settings/mod.rs b/foundations/src/settings/mod.rs similarity index 88% rename from bedrock/src/settings/mod.rs rename to foundations/src/settings/mod.rs index 17203f7..ad5dea6 100644 --- a/bedrock/src/settings/mod.rs +++ b/foundations/src/settings/mod.rs @@ -1,26 +1,28 @@ //! Serializable service settings with documentation. //! -//! Bedrock provides API to generate YAML-serializable documented settings for a service. Such +//! Foundations provides API to generate YAML-serializable documented settings for a service. Such //! settings structures can be used in conjunction with [`Cli`] which takes care of settings parsing //! and generation of default configuration. However, provided settings functionality can be used //! standalone as well. //! -//! Bedrock automatically implements [`Settings`] trait for structures or enums annotated with +//! Foundations automatically implements [`Settings`] trait for structures or enums annotated with //! [`settings`] attribute macro. Macro converts Rust doc comments into YAML field documentation and //! also implements all the traits required for settings serialization and default configuration. //! -//! Bedrock's settings philosophy is that service should always have default configuration that +//! Foundations' settings philosophy is that service should always have default configuration that //! works out of the box, therefore the requirement for all settings structures and enums to //! implement the `Default` trait. //! //! # Explicit subsettings //! -//! The other important requirement of Bedrock's settings is to present as much documentation for +//! The other important requirement of Foundations' settings is to present as much documentation for //! the default settings as possible, so all the possible configuration is explicitly visible. //! //! Consider the following TLS settings structure: //! //! ```no_run +//! # use foundations::settings::settings; +//! # //! #[settings] //! struct TlsSettings { //! /// Certificate to be presented by the server @@ -35,10 +37,22 @@ //! common approach to reflect that in Rust would be to wrap TLS settings in `Option`: //! //! ```no_run +//! # use foundations::settings::settings; +//! # use std::net::SocketAddr; +//! # +//! # #[settings] +//! # struct TlsSettings { +//! # /// Certificate to be presented by the server +//! # cert: String, +//! # +//! # /// Certificate's public key +//! # pkey: String +//! # } +//! # //! #[settings] //! struct ListenerSettings { //! /// Address of the server -//! addr: SocketAddr, +//! addr: foundations::settings::net::SocketAddr, //! //! /// TLS settings //! tls: Option @@ -54,6 +68,9 @@ //! an explicit `enabled` knob to the `TlsSettings`: //! //! ```no_run +//! # use foundations::settings::settings; +//! # use std::net::SocketAddr; +//! # //! #[settings] //! struct TlsSettings { //! /// Enables TLS for the listener @@ -69,7 +86,7 @@ //! #[settings] //! struct ListenerSettings { //! /// Address of the server -//! addr: SocketAddr, +//! addr: foundations::settings::net::SocketAddr, //! //! /// TLS settings //! tls: TlsSettings @@ -78,7 +95,7 @@ //! //! # Dealing with 3rd-party crate types in settings //! -//! Even though Bedrock strives to implement the [`Settings`] trait for most commonly used types, +//! Even though Foundations strives to implement the [`Settings`] trait for most commonly used types, //! it's not uncommon to have a type from a 3rd-party crate in your configuration whose code you //! don't control and, thus, can't implement the trait for it. //! @@ -90,6 +107,9 @@ //! to convert to the original structure for it to be used in your code: //! //! ```no_run +//! # use foundations::settings::settings; +//! # use std::str::FromStr; +//! # //! // NOTE: there's no `Default` implementation for the wrapped type, so we disable //! // `#[derive(Default)]` generation by the macro. //! #[settings(impl_default = false)] @@ -99,7 +119,7 @@ //! // Provide a reasonable default implementation. //! impl Default for Ipv4Network { //! fn default() -> Self { -//! Ipv4Network::from_str("10.0.0.0/8").unwrap() +//! ipnetwork::Ipv4Network::from_str("10.0.0.0/8").map(Self).unwrap() //! } //! } //! @@ -137,7 +157,7 @@ use std::path::Path; /// /// # Example /// ``` -/// use bedrock::settings::{to_yaml_string, settings}; +/// use foundations::settings::{to_yaml_string, settings}; /// /// #[settings] /// struct NestedStruct { @@ -186,7 +206,7 @@ use std::path::Path; /// `#[serde(default = ...)]` attributes: /// /// ``` -/// use bedrock::settings::settings; +/// use foundations::settings::settings; /// /// #[settings] /// struct SimpleStruct { @@ -213,7 +233,7 @@ use std::path::Path; /// is not a unit variant, in this case usage of `#[default]` attribute will fail to compile: /// /// ```compile_fail -/// use bedrock::settings::settings; +/// use foundations::settings::settings; /// /// #[settings] /// enum WonderfulVariants { @@ -226,7 +246,7 @@ use std::path::Path; /// The macro can be instructed to not generate [`Default`] implementation to workaround that: /// /// ``` -/// use bedrock::settings::settings; +/// use foundations::settings::settings; /// /// #[settings(impl_default = false)] /// #[derive(PartialEq)] @@ -253,7 +273,7 @@ use std::path::Path; /// can be instructed to not automatically generate derive implementation: /// /// ``` -/// use bedrock::settings::settings; +/// use foundations::settings::settings; /// use std::fmt; /// /// #[settings(impl_debug = false)] @@ -270,12 +290,12 @@ use std::path::Path; /// /// # Renamed or reexported crate /// -/// The macro will fail to compile if `bedrock` crate is reexported. However, the crate path +/// The macro will fail to compile if `foundations` crate is reexported. However, the crate path /// can be explicitly specified for the macro to workaround that: /// /// ``` /// mod reexport { -/// pub use bedrock::*; +/// pub use foundations::*; /// } /// /// #[reexport::settings::settings(crate_path = "reexport")] @@ -285,7 +305,7 @@ use std::path::Path; /// ``` /// /// [`Settings`]: crate::settings::Settings -pub use bedrock_macros::settings; +pub use foundations_macros::settings; /// A trait for a YAML-serializable settings with documentation. /// @@ -306,7 +326,7 @@ pub trait Settings: /// /// # Examples /// ``` - /// use bedrock::settings::{Settings, to_yaml_string}; + /// use foundations::settings::{Settings, to_yaml_string}; /// use serde::{Serialize, Deserialize}; /// use std::collections::HashMap; /// diff --git a/bedrock/src/settings/net.rs b/foundations/src/settings/net.rs similarity index 100% rename from bedrock/src/settings/net.rs rename to foundations/src/settings/net.rs diff --git a/bedrock/src/telemetry/log/field_dedup.rs b/foundations/src/telemetry/log/field_dedup.rs similarity index 98% rename from bedrock/src/telemetry/log/field_dedup.rs rename to foundations/src/telemetry/log/field_dedup.rs index e7ce53f..c995e7c 100644 --- a/bedrock/src/telemetry/log/field_dedup.rs +++ b/foundations/src/telemetry/log/field_dedup.rs @@ -39,7 +39,7 @@ mod tests { // NOTE: test log uses field dedup filter. use super::super::testing::TestLogRecord; use crate::telemetry::{log, TestTelemetryContext}; - use bedrock_macros::with_test_telemetry; + use foundations_macros::with_test_telemetry; #[with_test_telemetry(test, crate_path = "crate")] fn remove_record_field_duplicates(ctx: TestTelemetryContext) { diff --git a/bedrock/src/telemetry/log/field_filtering.rs b/foundations/src/telemetry/log/field_filtering.rs similarity index 100% rename from bedrock/src/telemetry/log/field_filtering.rs rename to foundations/src/telemetry/log/field_filtering.rs diff --git a/bedrock/src/telemetry/log/field_redact.rs b/foundations/src/telemetry/log/field_redact.rs similarity index 98% rename from bedrock/src/telemetry/log/field_redact.rs rename to foundations/src/telemetry/log/field_redact.rs index 7c70664..27f20a2 100644 --- a/bedrock/src/telemetry/log/field_redact.rs +++ b/foundations/src/telemetry/log/field_redact.rs @@ -43,7 +43,7 @@ mod tests { // NOTE: test log uses field redact filter. use crate::telemetry::settings::LoggingSettings; use crate::telemetry::{log, log::TestLogRecord, TestTelemetryContext}; - use bedrock_macros::with_test_telemetry; + use foundations_macros::with_test_telemetry; use slog::Level; #[with_test_telemetry(test, crate_path = "crate")] diff --git a/bedrock/src/telemetry/log/init.rs b/foundations/src/telemetry/log/init.rs similarity index 100% rename from bedrock/src/telemetry/log/init.rs rename to foundations/src/telemetry/log/init.rs diff --git a/bedrock/src/telemetry/log/internal.rs b/foundations/src/telemetry/log/internal.rs similarity index 100% rename from bedrock/src/telemetry/log/internal.rs rename to foundations/src/telemetry/log/internal.rs diff --git a/bedrock/src/telemetry/log/log_volume.rs b/foundations/src/telemetry/log/log_volume.rs similarity index 86% rename from bedrock/src/telemetry/log/log_volume.rs rename to foundations/src/telemetry/log/log_volume.rs index 763cc55..ccc068f 100644 --- a/bedrock/src/telemetry/log/log_volume.rs +++ b/foundations/src/telemetry/log/log_volume.rs @@ -1,10 +1,10 @@ -//! bedrock::telemetry::log::log_volume_metrics provides metrics collection based on log volume. +//! foundations::telemetry::log::log_volume_metrics provides metrics collection based on log volume. use crate::telemetry::metrics::Counter; use slog::{Drain, Never, OwnedKVList, Record, SendSyncRefUnwindSafeDrain}; #[crate::telemetry::metrics::metrics(crate_path = "crate")] -mod bedrock { +mod foundations { pub fn log_record_count(level: &'static str) -> Counter; } @@ -37,7 +37,7 @@ where /// LogVolumeMetricsDrain simply increments the log volume metrics for each log. fn log(&self, record: &Record, values: &OwnedKVList) -> Result { let res = self.inner.log(record, values); - bedrock::log_record_count(record.level().as_str()).inc(); + foundations::log_record_count(record.level().as_str()).inc(); res } } diff --git a/bedrock/src/telemetry/log/mod.rs b/foundations/src/telemetry/log/mod.rs similarity index 92% rename from bedrock/src/telemetry/log/mod.rs rename to foundations/src/telemetry/log/mod.rs index bfa8707..64616bd 100644 --- a/bedrock/src/telemetry/log/mod.rs +++ b/foundations/src/telemetry/log/mod.rs @@ -43,9 +43,9 @@ pub fn set_verbosity(level: Level) -> Result<()> { Ok(()) } -/// Returns current log as a raw [slog] crate's `Logger` used by Bedrock internally. +/// Returns current log as a raw [slog] crate's `Logger` used by Foundations internally. /// -/// Can be used to propagate the logging context to libraries that don't use Bedrock's +/// Can be used to propagate the logging context to libraries that don't use Foundations' /// telemetry. /// /// [slog]: https://crates.io/crates/slog @@ -65,9 +65,9 @@ pub fn slog_logger() -> Arc> { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::log::{self, TestLogRecord}; -/// use bedrock::telemetry::settings::Level; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::log::{self, TestLogRecord}; +/// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); @@ -131,9 +131,9 @@ macro_rules! __add_fields { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::log::{self, TestLogRecord}; -/// use bedrock::telemetry::settings::Level; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::log::{self, TestLogRecord}; +/// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); @@ -193,9 +193,9 @@ macro_rules! __error { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::log::{self, TestLogRecord}; -/// use bedrock::telemetry::settings::Level; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::log::{self, TestLogRecord}; +/// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); @@ -255,9 +255,9 @@ macro_rules! __warn { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::log::{self, TestLogRecord}; -/// use bedrock::telemetry::settings::Level; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::log::{self, TestLogRecord}; +/// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); @@ -317,9 +317,9 @@ macro_rules! __debug { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::log::{self, TestLogRecord}; -/// use bedrock::telemetry::settings::Level; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::log::{self, TestLogRecord}; +/// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); @@ -379,9 +379,9 @@ macro_rules! __info { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::log::{self, TestLogRecord}; -/// use bedrock::telemetry::settings::Level; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::log::{self, TestLogRecord}; +/// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); diff --git a/bedrock/src/telemetry/log/rate_limit.rs b/foundations/src/telemetry/log/rate_limit.rs similarity index 100% rename from bedrock/src/telemetry/log/rate_limit.rs rename to foundations/src/telemetry/log/rate_limit.rs diff --git a/bedrock/src/telemetry/log/testing.rs b/foundations/src/telemetry/log/testing.rs similarity index 100% rename from bedrock/src/telemetry/log/testing.rs rename to foundations/src/telemetry/log/testing.rs diff --git a/bedrock/src/telemetry/memory_profiler.rs b/foundations/src/telemetry/memory_profiler.rs similarity index 97% rename from bedrock/src/telemetry/memory_profiler.rs rename to foundations/src/telemetry/memory_profiler.rs index f4e35e8..b23820d 100644 --- a/bedrock/src/telemetry/memory_profiler.rs +++ b/foundations/src/telemetry/memory_profiler.rs @@ -90,8 +90,8 @@ impl MemoryProfiler { /// /// # Examples /// ``` - /// use bedrock::telemetry::MemoryProfiler; - /// use bedrock::telemetry::settings::MemoryProfilerSettings; + /// use foundations::telemetry::MemoryProfiler; + /// use foundations::telemetry::settings::MemoryProfilerSettings; /// /// #[tokio::main] /// async fn main() { @@ -139,8 +139,8 @@ impl MemoryProfiler { /// /// # Examples /// ``` - /// use bedrock::telemetry::MemoryProfiler; - /// use bedrock::telemetry::settings::MemoryProfilerSettings; + /// use foundations::telemetry::MemoryProfiler; + /// use foundations::telemetry::settings::MemoryProfilerSettings; /// /// let settings = MemoryProfilerSettings { /// enabled: true, diff --git a/bedrock/src/telemetry/metrics/init.rs b/foundations/src/telemetry/metrics/init.rs similarity index 100% rename from bedrock/src/telemetry/metrics/init.rs rename to foundations/src/telemetry/metrics/init.rs diff --git a/bedrock/src/telemetry/metrics/internal.rs b/foundations/src/telemetry/metrics/internal.rs similarity index 100% rename from bedrock/src/telemetry/metrics/internal.rs rename to foundations/src/telemetry/metrics/internal.rs diff --git a/bedrock/src/telemetry/metrics/mod.rs b/foundations/src/telemetry/metrics/mod.rs similarity index 91% rename from bedrock/src/telemetry/metrics/mod.rs rename to foundations/src/telemetry/metrics/mod.rs index 928c435..51bb6a1 100644 --- a/bedrock/src/telemetry/metrics/mod.rs +++ b/foundations/src/telemetry/metrics/mod.rs @@ -1,6 +1,6 @@ //! Metrics-related functionality. //! -//! Bedrock provides simple and ergonomic interface to [Prometheus] metrics: +//! Foundations provides simple and ergonomic interface to [Prometheus] metrics: //! - Use [`metrics`] macro to define regular metrics. //! - Use [`report_info`] function to register service information metrics (metrics, whose value is //! persistent during the service lifetime, e.g. software version). @@ -90,7 +90,7 @@ pub fn collect(settings: &MetricsSettings) -> Result { /// # // As rustdoc puts doc tests in `fn main()`, the implicit `use super::*;` inserted /// # // in the metric mod doesn't see `SomeLabel`, so we wrap the entire test in a module. /// # mod rustdoc_workaround { -/// use bedrock::telemetry::metrics::{metrics, Counter, Gauge, HistogramBuilder, TimeHistogram}; +/// use foundations::telemetry::metrics::{metrics, Counter, Gauge, HistogramBuilder, TimeHistogram}; /// use serde_with::DisplayFromStr; /// use std::net::IpAddr; /// use std::io; @@ -218,13 +218,13 @@ pub fn collect(settings: &MetricsSettings) -> Result { /// /// # Renamed or reexported crate /// -/// The macro will fail to compile if `bedrock` crate is reexported. However, the crate path +/// The macro will fail to compile if `foundations` crate is reexported. However, the crate path /// can be explicitly specified for the macro to workaround that: /// /// ``` /// # mod rustdoc_workaround { /// mod reexport { -/// pub use bedrock::*; +/// pub use foundations::*; /// } /// /// use self::reexport::telemetry::metrics::Counter; @@ -239,7 +239,7 @@ pub fn collect(settings: &MetricsSettings) -> Result { /// /// [telemetry server]: crate::telemetry::init_with_server /// [`MetricsSettings::report_optional`]: crate::telemetry::settings::MetricsSettings::report_optional -pub use bedrock_macros::metrics; +pub use foundations_macros::metrics; /// A macro that allows to define a Prometheus info metric. /// @@ -256,9 +256,9 @@ pub use bedrock_macros::metrics; /// # Renaming the metric. /// /// ``` -/// use bedrock::telemetry::metrics::{info_metric, report_info}; +/// use foundations::telemetry::metrics::{info_metric, report_info}; /// -/// bedrock::telemetry::init(&bedrock::service_info!(), &Default::default()); +/// foundations::telemetry::init(&foundations::service_info!(), &Default::default()); /// /// /// Build information /// #[info_metric(name = "build_info")] @@ -272,15 +272,15 @@ pub use bedrock_macros::metrics; /// ``` /// # Renamed or reexported crate /// -/// The macro will fail to compile if `bedrock` crate is reexported. However, the crate path +/// The macro will fail to compile if `foundations` crate is reexported. However, the crate path /// can be explicitly specified for the macro to workaround that: /// /// ``` -/// bedrock::telemetry::init(&bedrock::service_info!(), &Default::default()); +/// foundations::telemetry::init(&foundations::service_info!(), &Default::default()); /// /// # mod rustdoc_workaround { /// mod reexport { -/// pub use bedrock::*; +/// pub use foundations::*; /// } /// /// /// Build information @@ -290,7 +290,7 @@ pub use bedrock_macros::metrics; /// } /// # } /// ``` -pub use bedrock_macros::info_metric; +pub use foundations_macros::info_metric; /// Describes an info metric. /// @@ -310,9 +310,9 @@ pub trait InfoMetric: Serialize + Send + Sync + 'static { /// # Examples /// /// ``` -/// use bedrock::telemetry::metrics::{info_metric, report_info}; +/// use foundations::telemetry::metrics::{info_metric, report_info}; /// -/// bedrock::telemetry::init(&bedrock::service_info!(), &Default::default()); +/// foundations::telemetry::init(&foundations::service_info!(), &Default::default()); /// /// /// Build information /// #[info_metric] @@ -342,7 +342,7 @@ where /// # // As rustdoc puts doc tests in `fn main()`, the implicit `use super::*;` inserted /// # // in the metric mod doesn't see `SomeLabel`, so we wrap the entire test in a module. /// # mod rustdoc_workaround { -/// use bedrock::telemetry::metrics::{metrics, HistogramBuilder, TimeHistogram}; +/// use foundations::telemetry::metrics::{metrics, HistogramBuilder, TimeHistogram}; /// /// #[metrics] /// pub mod my_app_metrics { diff --git a/bedrock/src/telemetry/mod.rs b/foundations/src/telemetry/mod.rs similarity index 93% rename from bedrock/src/telemetry/mod.rs rename to foundations/src/telemetry/mod.rs index d1db200..e29ebf2 100644 --- a/bedrock/src/telemetry/mod.rs +++ b/foundations/src/telemetry/mod.rs @@ -1,4 +1,4 @@ -//! Bedrock provides telemetry functionality for: +//! Foundations provides telemetry functionality for: //! //! * logging //! * distributed tracing (backed by [Jaeger]) @@ -16,7 +16,7 @@ //! //! # Telemetry context //! -//! Bedrock's telemetry is designed to not interfere with the production code, so you usually don't +//! Foundations' telemetry is designed to not interfere with the production code, so you usually don't //! need to carry log handles or tracing spans around. However, it is contextual, allowing different //! code branches to have different telemetry contexts. For example, in an HTTP service, you may want //! separate logs for each HTTP request. Contextual log fields are implicitly added to log records @@ -35,7 +35,7 @@ //! //! # Testing //! Telemetry is an important part of the functionality for any production-grade services and -//! Bedrock provides API for telemetry testing: special testing context can be created with +//! Foundations provides API for telemetry testing: special testing context can be created with //! [`TelemetryContext::test`] method and framework provides a special [`with_test_telemetry`] macro //! to enable telemetry testing in `#[test]` and `#[tokio::test]`. //! @@ -104,8 +104,8 @@ pub use self::server::{ /// /// # Wrapping `#[test]` /// ``` -/// use bedrock::telemetry::tracing::{self, test_trace}; -/// use bedrock::telemetry::{with_test_telemetry, TestTelemetryContext}; +/// use foundations::telemetry::tracing::{self, test_trace}; +/// use foundations::telemetry::{with_test_telemetry, TestTelemetryContext}; /// /// #[with_test_telemetry(test)] /// fn sync_rust_test(ctx: TestTelemetryContext) { @@ -124,8 +124,8 @@ pub use self::server::{ /// /// # Wrapping `#[tokio::test]` /// ``` -/// use bedrock::telemetry::tracing::{self, test_trace}; -/// use bedrock::telemetry::{with_test_telemetry, TestTelemetryContext}; +/// use foundations::telemetry::tracing::{self, test_trace}; +/// use foundations::telemetry::{with_test_telemetry, TestTelemetryContext}; /// /// #[with_test_telemetry(tokio::test)] /// async fn wrap_tokio_test(ctx: TestTelemetryContext) { @@ -155,12 +155,12 @@ pub use self::server::{ /// /// # Renamed or reexported crate /// -/// The macro will fail to compile if `bedrock` crate is reexported. However, the crate path +/// The macro will fail to compile if `foundations` crate is reexported. However, the crate path /// can be explicitly specified for the macro to workaround that: /// /// ``` /// mod reexport { -/// pub use bedrock::*; +/// pub use foundations::*; /// } /// /// use reexport::telemetry::tracing::{self, test_trace}; @@ -181,7 +181,7 @@ pub use self::server::{ /// } /// ``` #[cfg(feature = "testing")] -pub use bedrock_macros::with_test_telemetry; +pub use foundations_macros::with_test_telemetry; /// Wrapper for a future that provides it with [`TelemetryContext`]. pub struct WithTelemetryContext<'f, T> { @@ -274,8 +274,8 @@ impl TelemetryContext { /// /// # Examples /// ``` - /// use bedrock::telemetry::TelemetryContext; - /// use bedrock::telemetry::tracing::{self, test_trace}; + /// use foundations::telemetry::TelemetryContext; + /// use foundations::telemetry::tracing::{self, test_trace}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -324,10 +324,10 @@ impl TelemetryContext { /// /// # Examples /// ``` - /// use bedrock::telemetry::TelemetryContext; - /// use bedrock::telemetry::tracing::{self, test_trace}; - /// use bedrock::telemetry::log::{self, TestLogRecord}; - /// use bedrock::telemetry::settings::Level; + /// use foundations::telemetry::TelemetryContext; + /// use foundations::telemetry::tracing::{self, test_trace}; + /// use foundations::telemetry::log::{self, TestLogRecord}; + /// use foundations::telemetry::settings::Level; /// /// #[tracing::span_fn("sync_fn")] /// fn some_sync_production_fn_that_we_test() { @@ -398,8 +398,8 @@ impl TelemetryContext { /// /// # Examples /// ``` - /// use bedrock::telemetry::TelemetryContext; - /// use bedrock::telemetry::tracing::{self, test_trace}; + /// use foundations::telemetry::TelemetryContext; + /// use foundations::telemetry::tracing::{self, test_trace}; /// /// #[tokio::main] /// async fn main() { @@ -456,8 +456,8 @@ impl TelemetryContext { /// /// # Examples /// ``` - /// use bedrock::telemetry::TelemetryContext; - /// use bedrock::telemetry::tracing::{self, test_trace}; + /// use foundations::telemetry::TelemetryContext; + /// use foundations::telemetry::tracing::{self, test_trace}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -510,8 +510,8 @@ impl TelemetryContext { /// /// # Examples /// ``` - /// use bedrock::telemetry::TelemetryContext; - /// use bedrock::telemetry::tracing::{self, test_trace}; + /// use foundations::telemetry::TelemetryContext; + /// use foundations::telemetry::tracing::{self, test_trace}; /// /// #[tokio::main] /// async fn main() { @@ -576,9 +576,9 @@ impl TelemetryContext { /// /// # Examples /// ``` - /// use bedrock::telemetry::TelemetryContext; - /// use bedrock::telemetry::log::{self, TestLogRecord}; - /// use bedrock::telemetry::settings::Level; + /// use foundations::telemetry::TelemetryContext; + /// use foundations::telemetry::log::{self, TestLogRecord}; + /// use foundations::telemetry::settings::Level; /// /// // Test context is used for demonstration purposes to show the resulting log records. /// let ctx = TelemetryContext::test(); diff --git a/bedrock/src/telemetry/scope.rs b/foundations/src/telemetry/scope.rs similarity index 100% rename from bedrock/src/telemetry/scope.rs rename to foundations/src/telemetry/scope.rs diff --git a/bedrock/src/telemetry/server.rs b/foundations/src/telemetry/server.rs similarity index 100% rename from bedrock/src/telemetry/server.rs rename to foundations/src/telemetry/server.rs diff --git a/bedrock/src/telemetry/settings/logging.rs b/foundations/src/telemetry/settings/logging.rs similarity index 97% rename from bedrock/src/telemetry/settings/logging.rs rename to foundations/src/telemetry/settings/logging.rs index b58edbd..4717d76 100644 --- a/bedrock/src/telemetry/settings/logging.rs +++ b/foundations/src/telemetry/settings/logging.rs @@ -86,7 +86,7 @@ impl Deref for LogVerbosity { /// Log volume metrics settings /// -/// If enabled, a counter metric will be exposed as _bedrock_log_record_count +/// If enabled, a counter metric will be exposed as _foundations_log_record_count /// with a tag "level" indicating the log level. #[cfg_attr(feature = "settings", settings(crate_path = "crate"))] #[cfg_attr(not(feature = "settings"), derive(Clone, Debug, Default))] diff --git a/bedrock/src/telemetry/settings/memory_profiler.rs b/foundations/src/telemetry/settings/memory_profiler.rs similarity index 100% rename from bedrock/src/telemetry/settings/memory_profiler.rs rename to foundations/src/telemetry/settings/memory_profiler.rs diff --git a/bedrock/src/telemetry/settings/metrics.rs b/foundations/src/telemetry/settings/metrics.rs similarity index 100% rename from bedrock/src/telemetry/settings/metrics.rs rename to foundations/src/telemetry/settings/metrics.rs diff --git a/bedrock/src/telemetry/settings/mod.rs b/foundations/src/telemetry/settings/mod.rs similarity index 100% rename from bedrock/src/telemetry/settings/mod.rs rename to foundations/src/telemetry/settings/mod.rs diff --git a/bedrock/src/telemetry/settings/rate_limit.rs b/foundations/src/telemetry/settings/rate_limit.rs similarity index 100% rename from bedrock/src/telemetry/settings/rate_limit.rs rename to foundations/src/telemetry/settings/rate_limit.rs diff --git a/bedrock/src/telemetry/settings/server.rs b/foundations/src/telemetry/settings/server.rs similarity index 100% rename from bedrock/src/telemetry/settings/server.rs rename to foundations/src/telemetry/settings/server.rs diff --git a/bedrock/src/telemetry/settings/tracing.rs b/foundations/src/telemetry/settings/tracing.rs similarity index 100% rename from bedrock/src/telemetry/settings/tracing.rs rename to foundations/src/telemetry/settings/tracing.rs diff --git a/bedrock/src/telemetry/testing.rs b/foundations/src/telemetry/testing.rs similarity index 100% rename from bedrock/src/telemetry/testing.rs rename to foundations/src/telemetry/testing.rs diff --git a/bedrock/src/telemetry/tracing/init.rs b/foundations/src/telemetry/tracing/init.rs similarity index 100% rename from bedrock/src/telemetry/tracing/init.rs rename to foundations/src/telemetry/tracing/init.rs diff --git a/bedrock/src/telemetry/tracing/internal.rs b/foundations/src/telemetry/tracing/internal.rs similarity index 100% rename from bedrock/src/telemetry/tracing/internal.rs rename to foundations/src/telemetry/tracing/internal.rs diff --git a/bedrock/src/telemetry/tracing/mod.rs b/foundations/src/telemetry/tracing/mod.rs similarity index 92% rename from bedrock/src/telemetry/tracing/mod.rs rename to foundations/src/telemetry/tracing/mod.rs index 3507ed9..c1ab3c2 100644 --- a/bedrock/src/telemetry/tracing/mod.rs +++ b/foundations/src/telemetry/tracing/mod.rs @@ -28,8 +28,8 @@ pub use rustracing_jaeger::span::SpanContextState as SerializableTraceState; /// /// # Example /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace}; /// /// #[tracing::span_fn("foo")] /// fn foo() { @@ -54,8 +54,8 @@ pub use rustracing_jaeger::span::SpanContextState as SerializableTraceState; /// /// # Using constants for span names /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace}; /// /// const FOO: &str = "foo"; /// @@ -82,12 +82,12 @@ pub use rustracing_jaeger::span::SpanContextState as SerializableTraceState; /// /// # Renamed or reexported crate /// -/// The macro will fail to compile if `bedrock` crate is reexported. However, the crate path +/// The macro will fail to compile if `foundations` crate is reexported. However, the crate path /// can be explicitly specified for the macro to workaround that: /// /// ``` /// mod reexport { -/// pub use bedrock::*; +/// pub use foundations::*; /// } /// /// use reexport::telemetry::TelemetryContext; @@ -115,7 +115,7 @@ pub use rustracing_jaeger::span::SpanContextState as SerializableTraceState; /// ``` /// /// [async_trait]: https://crates.io/crates/async-trait -pub use bedrock_macros::span_fn; +pub use foundations_macros::span_fn; /// A handle for the scope in which tracing span is active. /// @@ -165,8 +165,8 @@ pub fn trace_id() -> Option { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace, SerializableTraceState, StartTraceOptions}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace, SerializableTraceState, StartTraceOptions}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -221,8 +221,8 @@ pub fn state_for_trace_stitching() -> Option { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -262,8 +262,8 @@ pub fn span(name: impl Into>) -> SpanScope { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace, StartTraceOptions}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace, StartTraceOptions}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -308,9 +308,9 @@ pub fn start_trace( SpanScope::new(internal::start_trace(root_span_name, options).into()) } -/// Returns the current span as a raw [rustracing] crate's `Span` that is used by Bedrock internally. +/// Returns the current span as a raw [rustracing] crate's `Span` that is used by Foundations internally. /// -/// Can be used to propagate the tracing context to libraries that don't use Bedrock's +/// Can be used to propagate the tracing context to libraries that don't use Foundations' /// telemetry. /// /// [rustracing]: https://crates.io/crates/rustracing @@ -331,8 +331,8 @@ pub fn rustracing_span() -> Option>> { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace, TestTraceOptions}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace, TestTraceOptions}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -414,8 +414,8 @@ macro_rules! __add_span_tags { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace, TestTraceOptions}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace, TestTraceOptions}; /// /// // Test context is used for demonstration purposes to show the resulting traces. /// let ctx = TelemetryContext::test(); @@ -479,8 +479,8 @@ macro_rules! __add_span_log_fields { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace, TestTraceOptions}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace, TestTraceOptions}; /// use std::time::SystemTime; /// /// // Test context is used for demonstration purposes to show the resulting traces. @@ -517,8 +517,8 @@ macro_rules! __set_span_start_time { /// /// # Examples /// ``` -/// use bedrock::telemetry::TelemetryContext; -/// use bedrock::telemetry::tracing::{self, test_trace, TestTraceOptions}; +/// use foundations::telemetry::TelemetryContext; +/// use foundations::telemetry::tracing::{self, test_trace, TestTraceOptions}; /// use std::time::SystemTime; /// /// // Test context is used for demonstration purposes to show the resulting traces. @@ -559,7 +559,7 @@ macro_rules! __set_span_finish_time { /// /// # Examples /// ``` -/// use bedrock::telemetry::tracing::{test_trace, TestSpan, TestTrace}; +/// use foundations::telemetry::tracing::{test_trace, TestSpan, TestTrace}; /// use std::time::SystemTime; /// /// let trace = test_trace! { @@ -625,7 +625,7 @@ macro_rules! __set_span_finish_time { /// sorts the provided log records this way during expansion. /// /// ``` -/// use bedrock::telemetry::tracing::{test_trace, TestSpan, TestTrace}; +/// use foundations::telemetry::tracing::{test_trace, TestSpan, TestTrace}; /// use rustracing::tag::TagValue; /// use std::time::SystemTime; /// diff --git a/bedrock/src/telemetry/tracing/rate_limit.rs b/foundations/src/telemetry/tracing/rate_limit.rs similarity index 100% rename from bedrock/src/telemetry/tracing/rate_limit.rs rename to foundations/src/telemetry/tracing/rate_limit.rs diff --git a/bedrock/src/telemetry/tracing/testing.rs b/foundations/src/telemetry/tracing/testing.rs similarity index 98% rename from bedrock/src/telemetry/tracing/testing.rs rename to foundations/src/telemetry/tracing/testing.rs index 78d32c0..74d1e15 100644 --- a/bedrock/src/telemetry/tracing/testing.rs +++ b/foundations/src/telemetry/tracing/testing.rs @@ -29,8 +29,8 @@ impl TestTrace { /// /// # Examples /// ``` - /// use bedrock::telemetry::tracing::{self, test_trace}; - /// use bedrock::telemetry::{TelemetryContext, TestTelemetryContext}; + /// use foundations::telemetry::tracing::{self, test_trace}; + /// use foundations::telemetry::{TelemetryContext, TestTelemetryContext}; /// /// #[tracing::span_fn("foo")] /// fn foo() { diff --git a/bedrock/src/utils.rs b/foundations/src/utils.rs similarity index 100% rename from bedrock/src/utils.rs rename to foundations/src/utils.rs diff --git a/bedrock/tests/data/settings_complex.yaml b/foundations/tests/data/settings_complex.yaml similarity index 100% rename from bedrock/tests/data/settings_complex.yaml rename to foundations/tests/data/settings_complex.yaml diff --git a/bedrock/tests/data/settings_enum_fields.yaml b/foundations/tests/data/settings_enum_fields.yaml similarity index 100% rename from bedrock/tests/data/settings_enum_fields.yaml rename to foundations/tests/data/settings_enum_fields.yaml diff --git a/bedrock/tests/data/settings_nested_duplicate_field.yaml b/foundations/tests/data/settings_nested_duplicate_field.yaml similarity index 100% rename from bedrock/tests/data/settings_nested_duplicate_field.yaml rename to foundations/tests/data/settings_nested_duplicate_field.yaml diff --git a/bedrock/tests/data/settings_nested_struct.yaml b/foundations/tests/data/settings_nested_struct.yaml similarity index 100% rename from bedrock/tests/data/settings_nested_struct.yaml rename to foundations/tests/data/settings_nested_struct.yaml diff --git a/bedrock/tests/data/settings_simple_config_with_docs.yaml b/foundations/tests/data/settings_simple_config_with_docs.yaml similarity index 100% rename from bedrock/tests/data/settings_simple_config_with_docs.yaml rename to foundations/tests/data/settings_simple_config_with_docs.yaml diff --git a/bedrock/tests/data/with_map.yaml b/foundations/tests/data/with_map.yaml similarity index 100% rename from bedrock/tests/data/with_map.yaml rename to foundations/tests/data/with_map.yaml diff --git a/bedrock/tests/data/with_option_none.yaml b/foundations/tests/data/with_option_none.yaml similarity index 100% rename from bedrock/tests/data/with_option_none.yaml rename to foundations/tests/data/with_option_none.yaml diff --git a/bedrock/tests/data/with_option_some.yaml b/foundations/tests/data/with_option_some.yaml similarity index 100% rename from bedrock/tests/data/with_option_some.yaml rename to foundations/tests/data/with_option_some.yaml diff --git a/bedrock/tests/logging.rs b/foundations/tests/logging.rs similarity index 69% rename from bedrock/tests/logging.rs rename to foundations/tests/logging.rs index ac217ad..a2ac23b 100644 --- a/bedrock/tests/logging.rs +++ b/foundations/tests/logging.rs @@ -1,7 +1,7 @@ -use bedrock::telemetry::log::warn; -use bedrock::telemetry::settings::{LoggingSettings, RateLimitingSettings}; -use bedrock::telemetry::TestTelemetryContext; -use bedrock_macros::with_test_telemetry; +use foundations::telemetry::log::warn; +use foundations::telemetry::settings::{LoggingSettings, RateLimitingSettings}; +use foundations::telemetry::TestTelemetryContext; +use foundations_macros::with_test_telemetry; #[with_test_telemetry(test)] fn test_rate_limiter(mut ctx: TestTelemetryContext) { diff --git a/bedrock/tests/settings.rs b/foundations/tests/settings.rs similarity index 94% rename from bedrock/tests/settings.rs rename to foundations/tests/settings.rs index bc777ad..e54c18a 100644 --- a/bedrock/tests/settings.rs +++ b/foundations/tests/settings.rs @@ -1,6 +1,6 @@ -use bedrock::settings::collections::Map; -use bedrock::settings::net::SocketAddr; -use bedrock::settings::{settings, to_yaml_string}; +use foundations::settings::collections::Map; +use foundations::settings::net::SocketAddr; +use foundations::settings::{settings, to_yaml_string}; #[settings] struct NestedStruct { @@ -134,14 +134,14 @@ impl Default for NoDefaultEnum { } } -mod bedrock_reexport { +mod foundations_reexport { pub(crate) mod nested { - pub(crate) use bedrock::*; + pub(crate) use foundations::*; } } // NOTE: this is basically a smoke test structure - it won't compile if `crate_path` is broken -#[settings(crate_path = "bedrock_reexport::nested")] +#[settings(crate_path = "foundations_reexport::nested")] struct StructWithCrateReexport { b: bool, } diff --git a/bedrock/tests/telemetry_server.rs b/foundations/tests/telemetry_server.rs similarity index 87% rename from bedrock/tests/telemetry_server.rs rename to foundations/tests/telemetry_server.rs index c7fd8b2..66bc691 100644 --- a/bedrock/tests/telemetry_server.rs +++ b/foundations/tests/telemetry_server.rs @@ -1,14 +1,14 @@ -use bedrock::telemetry::settings::{TelemetryServerSettings, TelemetrySettings}; -use bedrock::telemetry::TelemetryServerRoute; +use foundations::telemetry::settings::{TelemetryServerSettings, TelemetrySettings}; +use foundations::telemetry::TelemetryServerRoute; use futures_util::FutureExt; use hyper::{Method, Response}; use std::net::{Ipv4Addr, SocketAddr}; #[cfg(target_os = "linux")] -use bedrock::telemetry::settings::MemoryProfilerSettings; +use foundations::telemetry::settings::MemoryProfilerSettings; #[cfg(target_os = "linux")] -use bedrock::telemetry::MemoryProfiler; +use foundations::telemetry::MemoryProfiler; #[tokio::test] async fn telemetry_server() { @@ -36,8 +36,8 @@ async fn telemetry_server() { ); tokio::spawn( - bedrock::telemetry::init_with_server( - &bedrock::service_info!(), + foundations::telemetry::init_with_server( + &foundations::service_info!(), &settings, vec![TelemetryServerRoute { path: "/custom-route".into(), diff --git a/bedrock/tests/tracing.rs b/foundations/tests/tracing.rs similarity index 77% rename from bedrock/tests/tracing.rs rename to foundations/tests/tracing.rs index c385cb6..51f60b4 100644 --- a/bedrock/tests/tracing.rs +++ b/foundations/tests/tracing.rs @@ -1,7 +1,7 @@ -use bedrock::telemetry::settings::{RateLimitingSettings, TracingSettings}; -use bedrock::telemetry::tracing; -use bedrock::telemetry::TestTelemetryContext; -use bedrock_macros::with_test_telemetry; +use foundations::telemetry::settings::{RateLimitingSettings, TracingSettings}; +use foundations::telemetry::tracing; +use foundations::telemetry::TestTelemetryContext; +use foundations_macros::with_test_telemetry; fn make_test_trace(idx: usize) { let _root1 = tracing::span(format!("root{idx}")); diff --git a/bedrock/tests/with_test_telemetry.rs b/foundations/tests/with_test_telemetry.rs similarity index 84% rename from bedrock/tests/with_test_telemetry.rs rename to foundations/tests/with_test_telemetry.rs index c67443f..2e4a335 100644 --- a/bedrock/tests/with_test_telemetry.rs +++ b/foundations/tests/with_test_telemetry.rs @@ -1,5 +1,5 @@ -use bedrock::telemetry::tracing::{self, test_trace}; -use bedrock::telemetry::{with_test_telemetry, TestTelemetryContext}; +use foundations::telemetry::tracing::{self, test_trace}; +use foundations::telemetry::{with_test_telemetry, TestTelemetryContext}; #[with_test_telemetry(tokio::test)] async fn wrap_tokio_test(ctx: TestTelemetryContext) { diff --git a/tools/gen-syscall-enum/src/main.rs b/tools/gen-syscall-enum/src/main.rs index 2b36767..67b6313 100644 --- a/tools/gen-syscall-enum/src/main.rs +++ b/tools/gen-syscall-enum/src/main.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use std::process::Command; const GLIBC_REPO: &str = "https://sourceware.org/git/glibc.git"; -const DST_DIR_REL_PATH: &str = "../../bedrock/src/seccomp/syscalls"; +const DST_DIR_REL_PATH: &str = "../../foundations/src/seccomp/syscalls"; const SYSCALL_SRC_DST: &[(&str, &str)] = &[ (