Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
database::integrated::database_coordinator Class Reference

Manages lifecycle and coordination of all database system adapters. More...

#include <database_coordinator.h>

Collaboration diagram for database::integrated::database_coordinator:
Collaboration graph

Classes

struct  coordinator_stats
 Get coordinator statistics. More...
 
class  impl
 

Public Member Functions

 database_coordinator (const unified_db_config &config)
 Construct coordinator with configuration.
 
 ~database_coordinator ()
 Destructor - ensures graceful shutdown.
 
 database_coordinator (const database_coordinator &)=delete
 
database_coordinatoroperator= (const database_coordinator &)=delete
 
 database_coordinator (database_coordinator &&) noexcept
 
database_coordinatoroperator= (database_coordinator &&) noexcept
 
common::VoidResult initialize ()
 Initialize all adapters in correct order.
 
common::VoidResult shutdown ()
 Shutdown all adapters in reverse order.
 
bool is_initialized () const
 Check if coordinator is initialized.
 
adapters::logger_adapterget_logger ()
 Get logger adapter.
 
adapters::monitoring_adapterget_monitor ()
 Get monitoring adapter.
 
adapters::thread_adapterget_thread_pool ()
 Get thread adapter.
 
common::Result< bool > check_health ()
 Perform aggregate health check of all adapters.
 
common::Result< coordinator_statsget_stats () const
 

Private Attributes

std::unique_ptr< implpimpl_
 

Detailed Description

Manages lifecycle and coordination of all database system adapters.

This class is responsible for:

  • Creating all adapter instances
  • Initializing them in the correct order
  • Providing access to initialized adapters
  • Shutting down in reverse order
  • Aggregating health checks
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 98 of file database_coordinator.h.

Constructor & Destructor Documentation

◆ database_coordinator() [1/3]

database::integrated::database_coordinator::database_coordinator ( const unified_db_config & config)
explicit

Construct coordinator with configuration.

Parameters
configUnified configuration for all adapters
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 386 of file database_coordinator.cpp.

387 : pimpl_(std::make_unique<impl>(config))
388{
389}

◆ ~database_coordinator()

database::integrated::database_coordinator::~database_coordinator ( )
default

◆ database_coordinator() [2/3]

database::integrated::database_coordinator::database_coordinator ( const database_coordinator & )
delete

◆ database_coordinator() [3/3]

database::integrated::database_coordinator::database_coordinator ( database_coordinator && )
defaultnoexcept

Member Function Documentation

◆ check_health()

common::Result< bool > database::integrated::database_coordinator::check_health ( )

Perform aggregate health check of all adapters.

Checks:

  • Logger is functional
  • Monitoring is collecting metrics
  • Thread pool is accepting tasks
Returns
true if all adapters are healthy
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 426 of file database_coordinator.cpp.

427{
428 return pimpl_->check_health();
429}

References pimpl_.

Referenced by test_full_integration(), and test_health_check().

Here is the caller graph for this function:

◆ get_logger()

adapters::logger_adapter * database::integrated::database_coordinator::get_logger ( )

Get logger adapter.

Returns
Pointer to logger adapter (nullptr if not initialized)
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 411 of file database_coordinator.cpp.

412{
413 return pimpl_->get_logger();
414}

References pimpl_.

Referenced by test_adapter_access(), test_full_integration(), and test_logger_functionality().

Here is the caller graph for this function:

◆ get_monitor()

adapters::monitoring_adapter * database::integrated::database_coordinator::get_monitor ( )

Get monitoring adapter.

Returns
Pointer to monitoring adapter (nullptr if not initialized)
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 416 of file database_coordinator.cpp.

417{
418 return pimpl_->get_monitor();
419}

References pimpl_.

Referenced by test_adapter_access(), test_full_integration(), and test_monitoring_functionality().

Here is the caller graph for this function:

◆ get_stats()

common::Result< database_coordinator::coordinator_stats > database::integrated::database_coordinator::get_stats ( ) const
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 431 of file database_coordinator.cpp.

432{
433 return pimpl_->get_stats();
434}

References pimpl_.

Referenced by test_statistics().

Here is the caller graph for this function:

◆ get_thread_pool()

adapters::thread_adapter * database::integrated::database_coordinator::get_thread_pool ( )

Get thread adapter.

Returns
Pointer to thread adapter (nullptr if not initialized)
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 421 of file database_coordinator.cpp.

422{
423 return pimpl_->get_thread_pool();
424}

References pimpl_.

Referenced by test_adapter_access(), test_full_integration(), and test_thread_pool_functionality().

Here is the caller graph for this function:

◆ initialize()

common::VoidResult database::integrated::database_coordinator::initialize ( )

Initialize all adapters in correct order.

Initialization order:

  1. Logger adapter (for observability)
  2. Monitoring adapter (for metrics)
  3. Thread adapter (for async operations)

If any initialization fails, previously initialized adapters are shut down cleanly.

Returns
Success or error with details
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 396 of file database_coordinator.cpp.

397{
398 return pimpl_->initialize();
399}

References initialize().

Referenced by initialize(), test_adapter_access(), test_automatic_shutdown_in_destructor(), test_basic_initialization_and_shutdown(), test_double_initialization(), test_full_integration(), test_health_check(), test_logger_functionality(), test_monitoring_functionality(), test_statistics(), and test_thread_pool_functionality().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_initialized()

bool database::integrated::database_coordinator::is_initialized ( ) const

Check if coordinator is initialized.

Returns
true if initialized, false otherwise
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 406 of file database_coordinator.cpp.

407{
408 return pimpl_->is_initialized();
409}

References pimpl_.

Referenced by test_basic_initialization_and_shutdown().

Here is the caller graph for this function:

◆ operator=() [1/2]

◆ operator=() [2/2]

database_coordinator & database::integrated::database_coordinator::operator= ( database_coordinator && )
defaultnoexcept

◆ shutdown()

common::VoidResult database::integrated::database_coordinator::shutdown ( )

Shutdown all adapters in reverse order.

Shutdown order (reverse of init):

  1. Thread adapter
  2. Monitoring adapter
  3. Logger adapter (last, for final logging)
Returns
Success or error with details
Examples
/home/runner/work/database_system/database_system/database/integrated/core/database_coordinator.h.

Definition at line 401 of file database_coordinator.cpp.

402{
403 return pimpl_->shutdown();
404}

References pimpl_.

Referenced by test_adapter_access(), test_basic_initialization_and_shutdown(), test_double_initialization(), test_full_integration(), test_health_check(), test_logger_functionality(), test_monitoring_functionality(), test_shutdown_without_initialization(), test_statistics(), and test_thread_pool_functionality().

Here is the caller graph for this function:

Member Data Documentation

◆ pimpl_

std::unique_ptr<impl> database::integrated::database_coordinator::pimpl_
private

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