Resilient
Public Types | Public Member Functions | List of all members
resilient::IRateLimiterStrategy< Permit, Error > Class Template Referenceabstract

Interface to specify the algorithm the Ratelimiter should use. More...

#include <ratelimiter.hpp>

Public Types

using permit_type = Permit
 The type of the permit returned by acquire.
 
using error_type = Error
 The type of the error returned by acquire.
 

Public Member Functions

virtual Variant< permit_type, error_typeacquire ()=0
 Acquire a single permit to execute a request. More...
 
virtual void release (permit_type)=0
 Release a permit that was previously acquired. More...
 

Detailed Description

template<typename Permit, typename Error>
class resilient::IRateLimiterStrategy< Permit, Error >

Interface to specify the algorithm the Ratelimiter should use.

Template Parameters
PermitThe type of permits the strategy returns.
ErrorThe kind of error returned when acquire fails.

Member Function Documentation

template<typename Permit, typename Error>
virtual Variant<permit_type, error_type> resilient::IRateLimiterStrategy< Permit, Error >::acquire ( )
pure virtual

Acquire a single permit to execute a request.

acquire() is called before invoking the function to wait for a permit. This call may block.

Returns
Either return a permit or an error. If a permit is returned release() is called with the permit.

Implemented in resilient::BlockingFixedConcurrentExecutionsStrategy.

template<typename Permit, typename Error>
virtual void resilient::IRateLimiterStrategy< Permit, Error >::release ( permit_type  )
pure virtual

Release a permit that was previously acquired.

release() is called after the invoked function returned or throwed.

Parameters
permit_typeThe permit returned by acquire().

Implemented in resilient::BlockingFixedConcurrentExecutionsStrategy.


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