Create network strategies in Pools class.
This commit is contained in:
parent
ee4f6e28f0
commit
3a0fdcac6f
8 changed files with 71 additions and 39 deletions
|
@ -44,9 +44,12 @@ class IStrategyListener;
|
|||
class FailoverStrategy : public IStrategy, public IClientListener
|
||||
{
|
||||
public:
|
||||
FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
FailoverStrategy(const std::vector<Pool> &pool, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
FailoverStrategy(int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
|
||||
~FailoverStrategy() override;
|
||||
|
||||
void add(const Pool &pool);
|
||||
|
||||
public:
|
||||
inline bool isActive() const override { return m_active >= 0; }
|
||||
|
||||
|
@ -64,7 +67,7 @@ protected:
|
|||
void onResultAccepted(Client *client, const SubmitResult &result, const char *error) override;
|
||||
|
||||
private:
|
||||
void add(const Pool &pool);
|
||||
inline Client *active() const { return m_pools[static_cast<size_t>(m_active)]; }
|
||||
|
||||
const bool m_quiet;
|
||||
const int m_retries;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue