DatabaseConfig class
Database configuration and file management.
Manages database file paths, initialization, and configuration using Boost.Filesystem for cross-platform path handling.
Public static functions
- static auto instance() -> DatabaseConfig&
- Get singleton instance.
Public functions
- void set_database_directory(const fs::path& path)
- Set the database directory path.
- auto get_database_directory() const -> fs::path
- Get the database directory path.
- auto get_database_file_path() const -> fs::path
- Get the main database file path.
- auto get_backup_file_path(const std::string& backup_id = "") const -> fs::path
- Get the backup database file path.
- auto get_connection_string() const -> std::string
- Get SQLite connection string with options.
- auto database_exists() const -> bool
- Check if database file exists.
- auto get_database_size() const -> std::uintmax_t
- Get database file size.
- auto extensions_enabled() const -> bool
- Enable SQLite extensions.
- void set_extensions_enabled(bool enabled)
- auto get_thread_pool_size() const -> unsigned int
- Get thread pool size for database operations.
- void set_thread_pool_size(unsigned int size)
Function documentation
void liarsdice:: database:: DatabaseConfig:: set_database_directory(const fs::path& path)
Set the database directory path.
| Parameters | |
|---|---|
| path | Directory where database files will be stored |
| Exceptions | |
| std::runtime_error | if path is invalid or cannot be created |
fs::path liarsdice:: database:: DatabaseConfig:: get_database_directory() const
Get the database directory path.
| Returns | Path to database directory |
|---|
fs::path liarsdice:: database:: DatabaseConfig:: get_database_file_path() const
Get the main database file path.
| Returns | Full path to the main database file |
|---|
fs::path liarsdice:: database:: DatabaseConfig:: get_backup_file_path(const std::string& backup_id = "") const
Get the backup database file path.
| Parameters | |
|---|---|
| backup_id | Optional backup identifier |
| Returns | Full path to the backup database file |
std::string liarsdice:: database:: DatabaseConfig:: get_connection_string() const
Get SQLite connection string with options.
| Returns | Connection string with thread safety and performance options |
|---|
bool liarsdice:: database:: DatabaseConfig:: database_exists() const
Check if database file exists.
| Returns | true if database file exists |
|---|
std::uintmax_t liarsdice:: database:: DatabaseConfig:: get_database_size() const
Get database file size.
| Returns | Size in bytes, or 0 if file doesn't exist |
|---|
bool liarsdice:: database:: DatabaseConfig:: extensions_enabled() const
Enable SQLite extensions.
| Returns | true if extensions are enabled |
|---|