29 return std::make_unique<backends::fallback_thread_backend>(config);
32 return std::make_unique<backends::null_thread_backend>(config);
35 return std::make_unique<backends::fallback_thread_backend>(config);
99 return backend_->execute(std::move(task));
Thread pool adapter for async database operations.
common::VoidResult shutdown()
Shutdown thread pool gracefully.
bool wait_for_completion_timeout(std::chrono::milliseconds timeout)
Wait for tasks with timeout.
common::VoidResult initialize()
Initialize thread pool.
void wait_for_completion()
Wait for all pending tasks to complete.
std::unique_ptr< backends::thread_backend > backend_
Thread backend implementation.
~thread_adapter()
Destructor - ensures graceful shutdown.
std::size_t queue_size() const
Get current queue size.
thread_adapter(const db_thread_config &config, thread_backend_type backend_type=thread_backend_type::auto_select)
Construct thread adapter with configuration.
std::size_t worker_count() const
Get number of worker threads.
bool is_initialized() const
Check if thread pool is initialized.
common::VoidResult execute(std::function< void()> task)
Execute a task (fire-and-forget)
static std::unique_ptr< backends::thread_backend > create_backend(const db_thread_config &config, thread_backend_type backend_type)
Create appropriate backend based on type.
bool is_idle() const
Check if thread pool is idle.
Fallback thread backend using std::thread.
Result< std::monostate > VoidResult
thread_backend_type
Thread backend type selection.
@ null
Synchronous execution (no threading)
@ auto_select
Automatically select best available backend.
@ fallback
Use std::thread pool.
static std::shared_ptr< core::database_backend > create_backend(backend_type type)
Create database backend instance.
backend_type
Database backend type enumeration.
kcenon::common::VoidResult VoidResult
Primary VoidResult type - use this for void operations.
Null thread backend (synchronous execution)
Thread pool configuration for async operations.
Thread pool adapter with runtime backend selection.
Abstract interface for thread pool backends.