Template Class pool_strategy

Inheritance Relationships

Derived Types

Class Documentation

template<typename Connector>
class stream_client::connector::pool_strategy

Interface for pool reconnection strategy.

Used by connection_pool to refill itself.

Subclassed by stream_client::connector::conservative_strategy< Connector >, stream_client::connector::greedy_strategy< Connector >

Public Types

using connector_type = typename std::remove_reference<Connector>::type
using stream_type = typename connector_type::stream_type
using append_func_type = typename std::function<void(std::unique_ptr<stream_type> &&session)>

Public Functions

virtual ~pool_strategy() = default

Destructor.

virtual bool refill(connector_type &connector, std::size_t vacant_places, append_func_type append_func) = 0

Creates new sessions via connector and add them to the pool up to vacant_places times.

Parameters
  • connector – Connector to use for new sessions.

  • vacant_places – Number of required connection to fulfill the pool.

  • append_func – This function is used to add new one connected session to pool.

Returns

true if all session have been successfully added.