Add misc. doccomments
All checks were successful
Build and test / check-license (push) Successful in 1m42s
Build and test / check (push) Successful in 1m50s
Build and test / build (push) Successful in 2m38s
Build and test / test (push) Successful in 4m44s
Build and test / docs (push) Successful in 6m1s

This commit is contained in:
2025-12-16 19:33:11 +09:00
parent 97908ce887
commit dfe20826c1
2 changed files with 18 additions and 1 deletions

View File

@@ -171,6 +171,10 @@ pub async fn handle_command(
}
}
/// Handle an unexpected or erroneous response from the server.
///
/// This function checks the provided response and returns an appropriate error message.
/// It is typically used in `match` branches for expecting a specific response type from the server.
pub fn erroneous_server_response(
response: Option<Result<Response, std::io::Error>>,
) -> anyhow::Result<()> {
@@ -190,6 +194,11 @@ pub fn erroneous_server_response(
}
}
/// Print a hint about which name prefixes the user is authorized to manage
/// by querying the server for valid name prefixes.
///
/// This function should be used when an authorization error occurs,
/// to help the user understand which databases or users they are allowed to manage.
pub async fn print_authorization_owner_hint(
server_connection: &mut ClientToServerMessageStream,
) -> anyhow::Result<()> {

View File

@@ -176,6 +176,8 @@ pub fn drop_privs() -> anyhow::Result<()> {
Ok(())
}
/// Bootstrap an internal server by forking a child process to run the server, giving it
/// the other half of a Unix socket pair to communicate with the client process.
fn bootstrap_internal_server_and_drop_privs(
config_path: Option<PathBuf>,
) -> anyhow::Result<StdUnixStream> {
@@ -237,6 +239,10 @@ fn invoke_server_with_config(config_path: PathBuf) -> anyhow::Result<StdUnixStre
}
}
/// Construct a MySQL connection pool that consists of exactly one connection.
///
/// This is used for the internal server in SUID/SGID mode, where the server session
/// only ever will get a single client.
async fn construct_single_connection_mysql_pool(
config: &MysqlConfig,
) -> anyhow::Result<sqlx::MySqlPool> {
@@ -262,8 +268,10 @@ async fn construct_single_connection_mysql_pool(
Ok(pool)
}
/// Run the server in the forked child process.
/// Run a single server session in the forked process.
///
/// This function will not return, but will exit the process with a success code.
/// The function assumes that it's caller has already forked the process.
fn run_forked_server(
config_path: PathBuf,
server_socket: StdUnixStream,