125 [[nodiscard]]
auto get_name() const ->
std::
string override;
131 [[nodiscard]] auto
is_enabled() const ->
bool override;
163 [[nodiscard]] auto
is_active() const ->
bool;
202 auto
scale_to(
std::
size_t target_workers) -> common::VoidResult;
Automatic scaling of thread pool workers based on load metrics.
Configuration for autoscaling behavior and thresholds.
Manages automatic scaling of thread pool workers based on load metrics.
Pool policy that implements automatic scaling for dynamic worker management.
autoscaling_pool_policy & operator=(const autoscaling_pool_policy &)=delete
auto get_stats() const -> autoscaling_stats
Gets current autoscaling statistics.
std::shared_ptr< autoscaler > autoscaler_
auto get_autoscaler() const -> std::shared_ptr< autoscaler >
Gets the underlying autoscaler.
autoscaling_pool_policy(thread_pool &pool, const autoscaling_policy &config={})
Constructs an autoscaling pool policy with the given configuration.
autoscaling_pool_policy(autoscaling_pool_policy &&)=delete
auto scale_to(std::size_t target_workers) -> common::VoidResult
Manually scales to a specific worker count.
void set_policy(const autoscaling_policy &config)
Updates the autoscaling policy configuration.
void start()
Starts the autoscaler monitor thread.
std::atomic< bool > enabled_
auto get_name() const -> std::string override
Gets the policy name.
~autoscaling_pool_policy() override
Destructor. Stops the autoscaler if running.
void set_enabled(bool enabled) override
Enables or disables the policy.
autoscaling_pool_policy(const autoscaling_pool_policy &)=delete
auto evaluate_now() -> scaling_decision
Manually triggers a scaling evaluation.
auto is_enabled() const -> bool override
Checks if the policy is enabled.
auto is_active() const -> bool
Checks if the autoscaler is currently active.
void on_job_start(job &j) override
Called when job starts executing.
autoscaling_pool_policy & operator=(autoscaling_pool_policy &&)=delete
void on_job_complete(job &j, bool success, const std::exception *error=nullptr) override
Called when a job completes.
auto on_enqueue(job &j) -> common::VoidResult override
Called before a job is enqueued.
void stop()
Stops the autoscaler monitor thread.
auto get_policy() const -> const autoscaling_policy &
Gets the current autoscaling policy configuration.
Represents an error in the thread system.
Represents a unit of work (task) to be executed, typically by a job queue.
Base interface for thread pool policies.
A thread pool for concurrent execution of jobs using multiple worker threads.
Core threading foundation of the thread system library.
Base interface for extensible thread pool behavior policies.
Configuration for autoscaling behavior.
Statistics for autoscaling operations.