mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-26 09:30:37 +00:00
## Problem `cargo +nightly doc` is giving a lot of warnings: broken links, naked URLs, etc. ## Summary of changes * update the `proc-macro2` dependency so that it can compile on latest Rust nightly, see https://github.com/dtolnay/proc-macro2/pull/391 and https://github.com/dtolnay/proc-macro2/issues/398 * allow the `private_intra_doc_links` lint, as linking to something that's private is always more useful than just mentioning it without a link: if the link breaks in the future, at least there is a warning due to that. Also, one might enable [`--document-private-items`](https://doc.rust-lang.org/cargo/commands/cargo-doc.html#documentation-options) in the future and make these links work in general. * fix all the remaining warnings given by `cargo +nightly doc` * make it possible to run `cargo doc` on stable Rust by updating `opentelemetry` and associated crates to version 0.19, pulling in a fix that previously broke `cargo doc` on stable: https://github.com/open-telemetry/opentelemetry-rust/pull/904 * Add `cargo doc` to CI to ensure that it won't get broken in the future. Fixes #2557 ## Future work * Potentially, it might make sense, for development purposes, to publish the generated rustdocs somewhere, like for example [how the rust compiler does it](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/index.html). I will file an issue for discussion.
56 lines
1.8 KiB
Rust
56 lines
1.8 KiB
Rust
//! Code to manage the storage broker
|
|
//!
|
|
//! In the local test environment, the data for each safekeeper is stored in
|
|
//!
|
|
//! ```text
|
|
//! .neon/safekeepers/<safekeeper id>
|
|
//! ```
|
|
use anyhow::Context;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use crate::{background_process, local_env};
|
|
|
|
pub fn start_broker_process(env: &local_env::LocalEnv) -> anyhow::Result<()> {
|
|
let broker = &env.broker;
|
|
let listen_addr = &broker.listen_addr;
|
|
|
|
print!("Starting neon broker at {}", listen_addr);
|
|
|
|
let args = [format!("--listen-addr={listen_addr}")];
|
|
|
|
let client = reqwest::blocking::Client::new();
|
|
background_process::start_process(
|
|
"storage_broker",
|
|
&env.base_data_dir,
|
|
&env.storage_broker_bin(),
|
|
args,
|
|
[],
|
|
background_process::InitialPidFile::Create(&storage_broker_pid_file_path(env)),
|
|
|| {
|
|
let url = broker.client_url();
|
|
let status_url = url.join("status").with_context(|| {
|
|
format!("Failed to append /status path to broker endpoint {url}",)
|
|
})?;
|
|
let request = client
|
|
.get(status_url)
|
|
.build()
|
|
.with_context(|| format!("Failed to construct request to broker endpoint {url}"))?;
|
|
match client.execute(request) {
|
|
Ok(resp) => Ok(resp.status().is_success()),
|
|
Err(_) => Ok(false),
|
|
}
|
|
},
|
|
)
|
|
.context("Failed to spawn storage_broker subprocess")?;
|
|
Ok(())
|
|
}
|
|
|
|
pub fn stop_broker_process(env: &local_env::LocalEnv) -> anyhow::Result<()> {
|
|
background_process::stop_process(true, "storage_broker", &storage_broker_pid_file_path(env))
|
|
}
|
|
|
|
fn storage_broker_pid_file_path(env: &local_env::LocalEnv) -> PathBuf {
|
|
env.base_data_dir.join("storage_broker.pid")
|
|
}
|