Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::database::PoolOptions< ClientType > Struct Template Reference

Health checking and reconnecting for a ConnectionPool. More...

#include <ConnectionPool.hpp>

Public Attributes

std::function< bool(ClientType &)> health_check
 
std::chrono::milliseconds initial_backoff {100}
 
std::chrono::milliseconds max_backoff {30000}
 
std::function< void(std::chrono::milliseconds, std::function< void()>)> schedule
 

Detailed Description

template<typename ClientType>
struct orbit::database::PoolOptions< ClientType >

Health checking and reconnecting for a ConnectionPool.

With a health check, a client found unusable (when acquired or released) is dropped and a replacement is connected in the background; failed attempts are retried with exponential backoff, from initial_backoff doubling up to max_backoff.

Member Data Documentation

◆ health_check

template<typename ClientType >
std::function<bool(ClientType&)> orbit::database::PoolOptions< ClientType >::health_check

True if a client is usable, e.g. [](auto& c) { return c.is_healthy(); }. Empty: clients are never checked or replaced.

◆ initial_backoff

template<typename ClientType >
std::chrono::milliseconds orbit::database::PoolOptions< ClientType >::initial_backoff {100}

◆ max_backoff

template<typename ClientType >
std::chrono::milliseconds orbit::database::PoolOptions< ClientType >::max_backoff {30000}

◆ schedule

template<typename ClientType >
std::function<void(std::chrono::milliseconds, std::function<void()>)> orbit::database::PoolOptions< ClientType >::schedule

Runs a task after a delay (the backoff). The default sleeps on a detached thread; pass one backed by your event loop's timers instead.


The documentation for this struct was generated from the following file: