|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Handles health and info endpoints. More...
#include <mitkHealthController.h>
Public Types | |
| using | UptimeCallback = std::function< std::optional< int64_t >()> |
| Callback type for retrieving server uptime. More... | |
Public Member Functions | |
| HealthController (DataStorageBridge &bridge) | |
| Construct a HealthController. More... | |
| void | SetUptimeCallback (UptimeCallback callback) |
| Set the callback for retrieving server uptime. More... | |
| void | HandleGET_health (const httplib::Request &req, httplib::Response &res) |
| Handle GET /health request. More... | |
| void | HandleGET_info (const httplib::Request &req, httplib::Response &res) |
| Handle GET /info request. More... | |
| void | HandleGET_config_file_access (const httplib::Request &req, httplib::Response &res) |
| Handle GET /config/file-access request. More... | |
| void | SetFileAccessConfig (FileAccessMode mode, const std::vector< std::string > &allowedDirs) |
| Set the file access configuration. More... | |
| void | SetMaxActiveTempDirsPerIp (size_t max) |
| Set the per-IP limit for concurrent file-reference temp directories. Reported by GET /config/file-access so clients know the eviction policy. More... | |
Handles health and info endpoints.
Endpoints:
Definition at line 37 of file mitkHealthController.h.
| using mitk::HealthController::UptimeCallback = std::function<std::optional<int64_t>()> |
Callback type for retrieving server uptime.
Returns the server uptime in seconds, or std::nullopt if not available.
Definition at line 45 of file mitkHealthController.h.
|
explicit |
Construct a HealthController.
| bridge | Reference to the DataStorageBridge for status checks. It is the instance controlled by the REST server to ensure requests from all controllers are handled thread safe and channeled towards the DataStorage. |
| void mitk::HealthController::HandleGET_config_file_access | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) |
Handle GET /config/file-access request.
Returns the current file access configuration, including the mode and, when restrictions are active, the list of allowed directories.
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::HealthController::HandleGET_health | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) |
Handle GET /health request.
Returns basic health status.
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::HealthController::HandleGET_info | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) |
Handle GET /info request.
Returns detailed server information.
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::HealthController::SetFileAccessConfig | ( | FileAccessMode | mode, |
| const std::vector< std::string > & | allowedDirs | ||
| ) |
Set the file access configuration.
| mode | The file access mode to apply. |
| allowedDirs | Directories to allow when mode is AllowedDirectories. |
| void mitk::HealthController::SetMaxActiveTempDirsPerIp | ( | size_t | max | ) |
Set the per-IP limit for concurrent file-reference temp directories. Reported by GET /config/file-access so clients know the eviction policy.
| void mitk::HealthController::SetUptimeCallback | ( | UptimeCallback | callback | ) |
Set the callback for retrieving server uptime.
| callback | Function that returns uptime in seconds, or std::nullopt if unavailable. |