|
Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
|
Singleton registry for database backend plugins. More...
#include <backend_registry.h>

Public Member Functions | |
| backend_registry (const backend_registry &)=delete | |
| backend_registry & | operator= (const backend_registry &)=delete |
| backend_registry (backend_registry &&)=delete | |
| backend_registry & | operator= (backend_registry &&)=delete |
| kcenon::common::VoidResult | register_backend (const std::string &name, backend_factory_fn factory) |
| Register a backend factory function. | |
| kcenon::common::VoidResult | unregister_backend (const std::string &name) |
| Unregister a backend (for testing or dynamic unloading) | |
| std::unique_ptr< database_backend > | create (const std::string &name) const |
| Create a backend instance by name. | |
| bool | has_backend (const std::string &name) const |
| Check if a backend is registered. | |
| std::vector< std::string > | available_backends () const |
| Get list of all registered backend names. | |
| size_t | backend_count () const |
| Get number of registered backends. | |
| void | clear () |
| Clear all registered backends (for testing) | |
Static Public Member Functions | |
| static backend_registry & | instance () |
| Get the singleton instance. | |
Private Member Functions | |
| backend_registry ()=default | |
| ~backend_registry ()=default | |
Private Attributes | |
| std::mutex | mutex_ |
| std::map< std::string, backend_factory_fn > | factories_ |
Singleton registry for database backend plugins.
Thread Safety:
Singleton Pattern:
Definition at line 72 of file backend_registry.h.
|
delete |
|
delete |
|
privatedefault |
|
privatedefault |
| std::vector< std::string > database::core::backend_registry::available_backends | ( | ) | const |
Get list of all registered backend names.
Thread Safety: This method is thread-safe
Example:
Definition at line 86 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by database::core::available_backends(), TEST_F(), and TEST_F().

| size_t database::core::backend_registry::backend_count | ( | ) | const |
Get number of registered backends.
Thread Safety: This method is thread-safe
Definition at line 104 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by TEST_F().

| void database::core::backend_registry::clear | ( | ) |
Clear all registered backends (for testing)
Thread Safety: This method is thread-safe
Warning: This should only be used in test code. It will remove all registered backends including built-in ones.
Definition at line 110 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by BackendRegistryTest::SetUp(), BackendRegistryTest::TearDown(), TEST_F(), and TEST_F().

| std::unique_ptr< database_backend > database::core::backend_registry::create | ( | const std::string & | name | ) | const |
Create a backend instance by name.
| name | Backend name (e.g., "postgresql", "sqlite") |
Thread Safety: This method is thread-safe
Example:
Definition at line 59 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by database::core::create_backend(), database::integrated::create_backend(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

| bool database::core::backend_registry::has_backend | ( | const std::string & | name | ) | const |
Check if a backend is registered.
| name | Backend name to check |
Thread Safety: This method is thread-safe
Definition at line 80 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by database::core::has_backend().

|
static |
Get the singleton instance.
Definition at line 14 of file backend_registry.cpp.
References instance().
Referenced by database::core::available_backends(), database::core::backend_registrar< BackendType >::backend_registrar(), database::core::create_backend(), database::integrated::create_backend(), database::core::has_backend(), instance(), BackendRegistryTest::SetUp(), BackendRegistryTest::TearDown(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().


|
delete |
|
delete |
| kcenon::common::VoidResult database::core::backend_registry::register_backend | ( | const std::string & | name, |
| backend_factory_fn | factory ) |
Register a backend factory function.
| name | Backend name (e.g., "postgresql", "sqlite") |
| factory | Factory function that creates backend instances |
Thread Safety: This method is thread-safe
Example:
Definition at line 20 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by database::core::backend_registrar< BackendType >::backend_registrar(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

| kcenon::common::VoidResult database::core::backend_registry::unregister_backend | ( | const std::string & | name | ) |
Unregister a backend (for testing or dynamic unloading)
| name | Backend name to unregister |
Thread Safety: This method is thread-safe
Definition at line 45 of file backend_registry.cpp.
References factories_, and mutex_.
Referenced by TEST_F(), TEST_F(), and TEST_F().

|
private |
Definition at line 179 of file backend_registry.h.
Referenced by available_backends(), backend_count(), clear(), create(), has_backend(), register_backend(), and unregister_backend().
|
mutableprivate |
Definition at line 178 of file backend_registry.h.
Referenced by available_backends(), backend_count(), clear(), create(), has_backend(), register_backend(), and unregister_backend().