60 name_ = std::move(value);
112 return {
error_info{1,
"Health check name is required",
"health_check_builder"}};
116 return {
error_info{2,
"Check function is required",
"health_check_builder"}};
119 std::shared_ptr<health_check> check = std::make_shared<lambda_health_check>(
121 return ok(std::move(check));
132 return std::make_shared<lambda_health_check>(
145 timeout_ = std::chrono::milliseconds{5000};
Result type for error handling with member function support.
Fluent builder for creating health checks.
health_check_builder & with_check(check_fn_type fn)
Set the check function.
std::function< health_check_result()> check_fn_type
Result< std::shared_ptr< health_check > > build() const
Build the health check.
std::chrono::milliseconds timeout_
std::shared_ptr< health_check > build_unsafe() const
Build the health check without validation.
health_check_builder & name(std::string value)
Set the health check name.
health_check_builder & type(health_check_type value)
Set the health check type.
health_check_builder & timeout(std::chrono::milliseconds value)
Set the check timeout.
health_check_builder()=default
health_check_builder & reset()
Reset the builder to initial state.
health_check_builder & critical(bool value)
Set whether this check is critical.
Base classes and types for health checking functionality.
health_check_type
Types of health checks supported by the system.
VoidResult ok()
Create a successful void result.
Standard error information used by Result<T>.
Result of a health check operation.