16#include <kcenon/common/resilience/circuit_breaker_config.h>
26 using common::resilience::circuit_breaker_config;
157 circuit_breaker_config circuit_breaker{};
441 throw std::invalid_argument(
"Invalid thread_system_config");
Configuration for backpressure and queue overflow policies.
Builder for thread_system_config.
auto enable_circuit_breaker() -> config_builder &
Enables circuit breaker with default settings.
auto with_watermarks(double low, double high) -> config_builder &
Sets backpressure watermarks.
auto enable_auto_scaling() -> config_builder &
Enables auto-scaling.
auto enable_work_stealing() -> config_builder &
Enables work stealing.
auto with_dag_retry_params(std::size_t max_retries, std::chrono::milliseconds delay) -> config_builder &
Sets DAG retry parameters.
auto enable_backpressure() -> config_builder &
Enables backpressure with default settings.
thread_system_config config_
auto with_worker_count(std::size_t count) -> config_builder &
Sets the number of worker threads.
auto with_priority_aging_params(std::chrono::milliseconds interval, int boost, int max_boost) -> config_builder &
Sets priority aging parameters.
auto with_open_duration(std::chrono::seconds duration) -> config_builder &
Sets circuit breaker open duration.
auto with_queue_capacity(std::size_t capacity) -> config_builder &
Sets the queue capacity.
auto with_backpressure_policy(backpressure_policy policy) -> config_builder &
Sets the backpressure policy.
auto build() -> thread_system_config
Builds the final configuration.
auto enable_priority_aging() -> config_builder &
Enables priority aging with default settings.
auto with_work_stealing_params(std::size_t max_attempts, std::chrono::microseconds backoff) -> config_builder &
Sets work stealing parameters.
auto with_dag_failure_policy(dag_failure_policy policy) -> config_builder &
Sets DAG failure policy.
auto with_failure_threshold(std::size_t threshold) -> config_builder &
Sets circuit breaker failure threshold.
Configuration for DAG scheduler including failure handling policies.
backpressure_policy
Policy for handling queue overflow conditions.
@ delay
Delay processing (attempt later)
@ low
Between low and high watermark.
@ high
Above high_watermark, approaching capacity.
@ block
Block until space is available (with timeout)
Core threading foundation of the thread system library.
dag_failure_policy
Defines how the DAG scheduler handles job failures.
Configuration for priority aging and starvation prevention.
Configuration for backpressure mechanisms.
backpressure_policy policy
The backpressure policy to use.
auto is_valid() const -> bool
Validates the configuration.
double low_watermark
Low watermark threshold (percentage of max_size).
double high_watermark
High watermark threshold (percentage of max_size).
Configuration options for the DAG scheduler.
std::size_t max_retries
Maximum number of retry attempts for failed jobs.
dag_failure_policy failure_policy
How to handle job failures.
std::chrono::milliseconds retry_delay
Delay between retry attempts.
Configuration for priority aging behavior.
bool enabled
Whether priority aging is enabled.
int priority_boost_per_interval
Amount of priority boost applied per aging interval.
int max_priority_boost
Maximum total priority boost that can be applied.
std::chrono::milliseconds aging_interval
Interval at which aging is applied.
Configuration for thread pool behavior.
std::size_t worker_count
Number of worker threads in the pool.
backpressure_config backpressure
Backpressure configuration.
bool yield_on_idle
Yield on idle.
std::size_t max_steal_attempts
Maximum steal attempts before backing off.
bool enable_work_stealing
Enable work stealing.
std::chrono::seconds shutdown_timeout
Shutdown timeout.
std::chrono::milliseconds wake_interval
Wake interval for idle workers.
std::chrono::microseconds steal_backoff
Backoff duration between steal attempts.
std::size_t queue_capacity
Maximum number of jobs in the queue.
std::chrono::seconds worker_idle_timeout
Worker idle timeout.
Configuration for resilience features.
circuit_breaker_config circuit_breaker
Circuit breaker configuration.
Configuration for dynamic scaling features.
priority_aging_config priority_aging
Priority aging configuration.
bool auto_scaling_enabled
Enable automatic scaling based on load.
Unified configuration for thread_system.
dag_config dag
DAG (Directed Acyclic Graph) configuration.
auto is_valid() const -> bool
Validates the entire configuration.
struct kcenon::thread::thread_system_config::scaling_config scaling
static auto builder() -> config_builder
Creates a builder for fluent configuration.
struct kcenon::thread::thread_system_config::resilience_config resilience
struct kcenon::thread::thread_system_config::pool_config pool