Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
database_dependency_check Class Reference
Inheritance diagram for database_dependency_check:
Inheritance graph
Collaboration diagram for database_dependency_check:
Collaboration graph

Public Member Functions

 database_dependency_check (bool connected)
 
std::string get_name () const override
 Get the unique name of this health check.
 
health_check_type get_type () const override
 Get the type of this health check.
 
bool is_critical () const override
 Check if this health check is critical.
 
health_check_result check () override
 Perform the health check.
 
- Public Member Functions inherited from kcenon::common::interfaces::health_check
 health_check ()=default
 
virtual ~health_check ()=default
 
 health_check (const health_check &)=delete
 
health_checkoperator= (const health_check &)=delete
 
 health_check (health_check &&)=delete
 
health_checkoperator= (health_check &&)=delete
 
virtual std::chrono::milliseconds get_timeout () const
 Get timeout duration for this health check.
 

Private Attributes

bool connected_
 

Detailed Description

Examples
health_check_example.cpp.

Definition at line 80 of file health_check_example.cpp.

Constructor & Destructor Documentation

◆ database_dependency_check()

database_dependency_check::database_dependency_check ( bool connected)
inlineexplicit
Examples
health_check_example.cpp.

Definition at line 83 of file health_check_example.cpp.

Member Function Documentation

◆ check()

health_check_result database_dependency_check::check ( )
inlineoverridevirtual

Perform the health check.

Returns
Health check result containing status and details

Implements kcenon::common::interfaces::health_check.

Examples
health_check_example.cpp.

Definition at line 89 of file health_check_example.cpp.

90 {
92 if (connected_)
93 {
94 result.status = health_status::healthy;
95 result.message = "Database connected";
96 }
97 else
98 {
99 result.status = health_status::unhealthy;
100 result.message = "Database connection failed";
101 }
102 return result;
103 }

References connected_, kcenon::common::interfaces::health_check_result::message, and kcenon::common::interfaces::health_check_result::status.

Referenced by main().

Here is the caller graph for this function:

◆ get_name()

std::string database_dependency_check::get_name ( ) const
inlineoverridevirtual

Get the unique name of this health check.

Returns
Health check name

Implements kcenon::common::interfaces::health_check.

Examples
health_check_example.cpp.

Definition at line 85 of file health_check_example.cpp.

85{ return "database"; }

Referenced by main().

Here is the caller graph for this function:

◆ get_type()

health_check_type database_dependency_check::get_type ( ) const
inlineoverridevirtual

Get the type of this health check.

Returns
Health check type

Implements kcenon::common::interfaces::health_check.

Examples
health_check_example.cpp.

Definition at line 86 of file health_check_example.cpp.

86{ return health_check_type::dependency; }

◆ is_critical()

bool database_dependency_check::is_critical ( ) const
inlineoverridevirtual

Check if this health check is critical.

Critical health checks affect the overall system health status. Non-critical checks are reported but don't impact system health.

Returns
true if this is a critical health check

Implements kcenon::common::interfaces::health_check.

Examples
health_check_example.cpp.

Definition at line 87 of file health_check_example.cpp.

87{ return true; }

Member Data Documentation

◆ connected_

bool database_dependency_check::connected_
private
Examples
health_check_example.cpp.

Definition at line 106 of file health_check_example.cpp.

Referenced by check().


The documentation for this class was generated from the following file: