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

#include <configuration.h>

Collaboration diagram for database::integrated::unified_db_config:
Collaboration graph

Public Member Functions

unified_db_configset_backend (backend_type type, const std::string &connection_str)
 Set database backend type and connection string.
 
unified_db_configset_credentials (const std::string &user, const std::string &pass)
 Set database credentials.
 
unified_db_configset_pool_size (std::size_t min, std::size_t max)
 Configure connection pool size.
 
unified_db_configset_pool_name (const std::string &name)
 Set connection pool name.
 
unified_db_configset_log_level (db_log_level level)
 Set minimum logging level.
 
unified_db_configenable_query_logging (bool enable=true)
 Enable/disable query logging.
 
unified_db_configenable_slow_query_logging (bool enable=true, std::chrono::milliseconds threshold=std::chrono::milliseconds(1000))
 Configure slow query detection.
 
unified_db_configenable_file_logging (bool enable=true, const std::string &directory="./logs")
 Enable file logging.
 
unified_db_configenable_monitoring (bool enable=true)
 Enable/disable monitoring.
 
unified_db_configenable_prometheus (bool enable=true, std::uint16_t port=9090, const std::string &endpoint="/metrics")
 Configure Prometheus metrics export.
 
unified_db_configset_thread_count (std::size_t count)
 Set thread pool size.
 
unified_db_configenable_priority_scheduling (bool enable=true)
 Enable priority-based scheduling.
 
unified_db_configenable_ssl (bool enable=true, const std::string &cert_path="", const std::string &key_path="")
 Enable SSL/TLS for database connections.
 
unified_db_configset_timeouts (std::chrono::seconds acquisition, std::chrono::seconds idle)
 Set connection timeouts.
 

Public Attributes

database_config database
 Database connection configuration.
 
pool_config connection_pool
 Connection pool configuration.
 
db_thread_config thread
 Thread pool configuration.
 
db_logger_config logger
 Logger configuration.
 
db_monitoring_config monitoring
 Monitoring configuration.
 
bool enable_common_system_integration { true }
 Enable common_system integration (Result pattern, ILogger, LOG_* macros)
 
bool enable_thread_system_integration { true }
 Enable thread_system integration (typed thread pools)
 
bool enable_monitoring_system_integration { true }
 Enable monitoring_system integration.
 

Detailed Description

Member Function Documentation

◆ enable_file_logging()

unified_db_config & database::integrated::unified_db_config::enable_file_logging ( bool enable = true,
const std::string & directory = "./logs" )
inline

Enable file logging.

Parameters
enableEnable logging to files
directoryDirectory for log files
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 390 of file configuration.h.

391 {
393 logger.log_directory = directory;
394 return *this;
395 }
bool enable_file_logging
Enable logging to file (in addition to console)
std::string log_directory
Directory for log files.
db_logger_config logger
Logger configuration.

References database::integrated::db_logger_config::enable_file_logging, database::integrated::db_logger_config::log_directory, and logger.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ enable_monitoring()

unified_db_config & database::integrated::unified_db_config::enable_monitoring ( bool enable = true)
inline

Enable/disable monitoring.

Parameters
enableTrue to enable metrics collection
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 402 of file configuration.h.

403 {
404 monitoring.enable_metrics = enable;
406 return *this;
407 }
bool enable_metrics
Enable metrics collection.
bool enable_health_checks
Enable health check endpoints.
db_monitoring_config monitoring
Monitoring configuration.

References database::integrated::db_monitoring_config::enable_health_checks, database::integrated::db_monitoring_config::enable_metrics, and monitoring.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ enable_priority_scheduling()

unified_db_config & database::integrated::unified_db_config::enable_priority_scheduling ( bool enable = true)
inline

Enable priority-based scheduling.

Parameters
enableEnable for both thread pool and connection pool
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 441 of file configuration.h.

442 {
445 if (enable)
446 {
448 }
449 return *this;
450 }
@ typed
Typed thread pool with priority support.
thread_pool_type pool_type
Thread pool implementation type.
bool enable_priority_scheduling
Enable priority-based task scheduling.
bool enable_priority_queue
Enable priority-based connection acquisition.
pool_config connection_pool
Connection pool configuration.
db_thread_config thread
Thread pool configuration.

References connection_pool, database::integrated::pool_config::enable_priority_queue, database::integrated::db_thread_config::enable_priority_scheduling, database::integrated::db_thread_config::pool_type, thread, and database::integrated::typed.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ enable_prometheus()

unified_db_config & database::integrated::unified_db_config::enable_prometheus ( bool enable = true,
std::uint16_t port = 9090,
const std::string & endpoint = "/metrics" )
inline

Configure Prometheus metrics export.

Parameters
enableEnable Prometheus endpoint
portPort for metrics server
endpointHTTP endpoint path
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 416 of file configuration.h.

418 {
422 return *this;
423 }
bool enable_prometheus_export
Enable Prometheus metrics export.
std::uint16_t prometheus_port
Port for Prometheus metrics server.
std::string prometheus_endpoint
HTTP endpoint for Prometheus scraping.

References database::integrated::db_monitoring_config::enable_prometheus_export, monitoring, database::integrated::db_monitoring_config::prometheus_endpoint, and database::integrated::db_monitoring_config::prometheus_port.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ enable_query_logging()

unified_db_config & database::integrated::unified_db_config::enable_query_logging ( bool enable = true)
inline

Enable/disable query logging.

Parameters
enableTrue to log all queries
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 364 of file configuration.h.

365 {
367 return *this;
368 }
bool enable_query_logging
Log all SQL queries executed.

References database::integrated::db_logger_config::enable_query_logging, and logger.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ enable_slow_query_logging()

unified_db_config & database::integrated::unified_db_config::enable_slow_query_logging ( bool enable = true,
std::chrono::milliseconds threshold = std::chrono::milliseconds(1000) )
inline

Configure slow query detection.

Parameters
enableEnable slow query logging
thresholdQueries slower than this are logged
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 376 of file configuration.h.

378 {
379 logger.log_slow_queries = enable;
380 logger.slow_query_threshold = threshold;
381 return *this;
382 }
std::chrono::milliseconds slow_query_threshold
Threshold for considering a query "slow".
bool log_slow_queries
Automatically detect and log slow queries.

References database::integrated::db_logger_config::log_slow_queries, logger, and database::integrated::db_logger_config::slow_query_threshold.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ enable_ssl()

unified_db_config & database::integrated::unified_db_config::enable_ssl ( bool enable = true,
const std::string & cert_path = "",
const std::string & key_path = "" )
inline

Enable SSL/TLS for database connections.

Parameters
enableEnable SSL
cert_pathPath to certificate file
key_pathPath to key file
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 459 of file configuration.h.

461 {
462 database.enable_ssl = enable;
463 database.ssl_cert_path = cert_path;
464 database.ssl_key_path = key_path;
465 return *this;
466 }

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ set_backend()

unified_db_config & database::integrated::unified_db_config::set_backend ( backend_type type,
const std::string & connection_str )
inline

Set database backend type and connection string.

Parameters
typeBackend type (postgres, sqlite, etc.)
connection_strConnection string in backend-specific format
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 304 of file configuration.h.

305 {
306 database.type = type;
307 database.connection_string = connection_str;
308 return *this;
309 }

Referenced by test_builder_pattern(), and test_struct_semantics().

Here is the caller graph for this function:

◆ set_credentials()

unified_db_config & database::integrated::unified_db_config::set_credentials ( const std::string & user,
const std::string & pass )
inline

Set database credentials.

Parameters
userDatabase username
passDatabase password
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 317 of file configuration.h.

318 {
319 database.username = user;
320 database.password = pass;
321 return *this;
322 }

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ set_log_level()

unified_db_config & database::integrated::unified_db_config::set_log_level ( db_log_level level)
inline

Set minimum logging level.

Parameters
levelMinimum level to output
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 353 of file configuration.h.

354 {
355 logger.min_log_level = level;
356 return *this;
357 }
db_log_level min_log_level
Minimum log level to output.

References logger, and database::integrated::db_logger_config::min_log_level.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ set_pool_name()

unified_db_config & database::integrated::unified_db_config::set_pool_name ( const std::string & name)
inline

Set connection pool name.

Parameters
namePool identifier for logging/monitoring
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 342 of file configuration.h.

343 {
345 return *this;
346 }
std::string pool_name
Unique name for this pool (for logging and monitoring)

References connection_pool, and database::integrated::pool_config::pool_name.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ set_pool_size()

unified_db_config & database::integrated::unified_db_config::set_pool_size ( std::size_t min,
std::size_t max )
inline

Configure connection pool size.

Parameters
minMinimum number of connections
maxMaximum number of connections
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 330 of file configuration.h.

331 {
334 return *this;
335 }
std::size_t min_connections
Minimum number of connections to maintain.
std::size_t max_connections
Maximum number of connections allowed.

References connection_pool, database::integrated::pool_config::max_connections, and database::integrated::pool_config::min_connections.

Referenced by test_builder_pattern(), and test_struct_semantics().

Here is the caller graph for this function:

◆ set_thread_count()

unified_db_config & database::integrated::unified_db_config::set_thread_count ( std::size_t count)
inline

Set thread pool size.

Parameters
countNumber of worker threads (0 = auto-detect)
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 430 of file configuration.h.

431 {
432 thread.thread_count = count;
433 return *this;
434 }
std::size_t thread_count
Number of worker threads (0 = auto-detect from hardware)

References thread, and database::integrated::db_thread_config::thread_count.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

◆ set_timeouts()

unified_db_config & database::integrated::unified_db_config::set_timeouts ( std::chrono::seconds acquisition,
std::chrono::seconds idle )
inline

Set connection timeouts.

Parameters
acquisitionTimeout for acquiring connections
idleTimeout before closing idle connections
Returns
Reference to this config for chaining
Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 474 of file configuration.h.

475 {
478 return *this;
479 }
std::chrono::seconds connection_timeout
Timeout for acquiring a connection from the pool.
std::chrono::seconds idle_timeout
Time before an idle connection is closed.

References connection_pool, database::integrated::pool_config::connection_timeout, and database::integrated::pool_config::idle_timeout.

Referenced by test_builder_pattern().

Here is the caller graph for this function:

Member Data Documentation

◆ connection_pool

◆ database

database_config database::integrated::unified_db_config::database

◆ enable_common_system_integration

bool database::integrated::unified_db_config::enable_common_system_integration { true }

Enable common_system integration (Result pattern, ILogger, LOG_* macros)

Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 288 of file configuration.h.

288{ true };

Referenced by test_default_values().

◆ enable_monitoring_system_integration

bool database::integrated::unified_db_config::enable_monitoring_system_integration { true }

Enable monitoring_system integration.

Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 294 of file configuration.h.

294{ true };

Referenced by test_default_values().

◆ enable_thread_system_integration

bool database::integrated::unified_db_config::enable_thread_system_integration { true }

Enable thread_system integration (typed thread pools)

Examples
/home/runner/work/database_system/database_system/database/integrated/core/configuration.h.

Definition at line 291 of file configuration.h.

291{ true };

Referenced by test_default_values().

◆ logger

◆ monitoring

◆ thread


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