Namespace reeflogic::reef_server_common::runtime C++ API Reference¶
Headers at a Glance¶
| Header | Classes | Functions | Macros |
|---|---|---|---|
reef_server_common/runtime_support.h |
1 | 4 | 0 |
Header reef_server_common/runtime_support.h¶
Process-lifetime helpers shared by both server binaries' main.
Collapses the SIGINT/SIGTERM handler install (InstallShutdownSignalHandlers), the shared ShutdownSignal() sig_atomic_t, the FlushLogsNoThrow shutdown-time logger drain, the RunUntilShutdown polling loop that joins a grpc::Server::Wait() thread with a 200 ms signal poll, and the PgUtilityShutdownScope RAII guard that requests PgUtility::Shutdown() on scope exit. Both reeflogic_server_admin and reeflogic_server link against this helper so the two main.cc files stay one-liners around the shared polling shape.
into a single test address space is intentional — either server's shutdown is the other's shutdown.
Note: The signal flag is process-wide; linking both server binaries
See also: commons/pg_utility.h
Classes¶
PgUtilityShutdownScope¶
| Public Member Signature | Description | Referenced Types |
|---|---|---|
~PgUtilityShutdownScope(); |
- | - |
Functions¶
| Signature | Description | Referenced Types |
|---|---|---|
void InstallShutdownSignalHandlers(); |
Installs SIGINT/SIGTERM handlers for graceful shutdown. The handlers update shared signal state returned by ShutdownSignal(). When registration fails, the function reports the failure to stderr and leaves any successfully installed handler unchanged. |
- |
[[nodiscard]] volatile std::sig_atomic_t &ShutdownSignal(); |
Returns global shutdown signal state set by signal handlers. Value is 0 until a termination signal is received. Note: the signal state is shared process-wide. Both reeflogic_server_admin and reeflogic_server can be linked into the same address space (testing fixtures) and will see the same flag; this is intentional — either server's shutdown is the other's shutdown. |
- |
void FlushLogsNoThrow(); |
Flushes logger buffers; never throws. LoggerNotInitializedError is ignored because shutdown paths may call this helper before logger setup. spdlog::spdlog_ex and allocation failures are reported to stderr and then suppressed to preserve shutdown progress. |
- |
void RunUntilShutdown(grpc::Server &server, std::string_view label); |
Ensures global PgUtility is shut down when leaving scope. This guard models a single shutdown action for process-lifetime PostgreSQL state. Copying or moving the guard would create additional objects whose destructors all request the same shutdown, so copy and move operations are disabled explicitly to keep ownership semantics clear. Blocks the calling thread until either the gRPC server's own Wait() returns or the process receives SIGINT/SIGTERM. Both reeflogic_server_admin and reeflogic_server use the same polling shape: a worker thread parks on grpc::Server::Wait() and a 200 ms tick watches ShutdownSignal() so signal delivery can unblock the loop without racing the gRPC reactor. This helper collapses that copy-pasted block onto a single call site. server: gRPC server to wait on. Must outlive this call. label: Short human-readable label used in the "Termination signal …" / " |
- |