Credit based flow control logic for both ends of the link.
More...
#include <creditflowcontrol.hpp>
Credit based flow control logic for both ends of the link.
◆ CreditFlowControl()
kanzi::connect::CreditFlowControl::CreditFlowControl |
( |
int |
credits = -1 , |
|
|
int |
creditReturnInterval = -1 |
|
) |
| |
|
explicit |
Constructor.
- Parameters
-
credits | the initial amount of credits available. |
creditReturnInterval | how often should credits be returned. meaningfull only on client side. |
◆ add()
void kanzi::connect::CreditFlowControl::add |
( |
int |
amount = 1 | ) |
|
Adds a credit, used on both sizes of connection to inform used/received credits.
- Parameters
-
amount | the amount of credits bring back. |
◆ getProductionCredit()
bool kanzi::connect::CreditFlowControl::getProductionCredit |
( |
| ) |
|
Gets a credit for production, used on producer/sender side.
- Returns
- true if at least one credit was available or credit system disabled.
◆ getReturnableCredits()
int kanzi::connect::CreditFlowControl::getReturnableCredits |
( |
| ) |
|
Retrieves the amount of credits that can be returned.
- Returns
- the credit amount. 0 if nothing to return at the moment.
◆ initialize()
void kanzi::connect::CreditFlowControl::initialize |
( |
int |
credits, |
|
|
int |
creditReturnInterval = -1 |
|
) |
| |
Initialize the object with provided credit information.
- Parameters
-
credits | the initial amount of credits available. |
creditReturnInterval | how often should credits be returned. meaningfull only on client side. |
◆ isEnabled()
bool kanzi::connect::CreditFlowControl::isEnabled |
( |
| ) |
const |
State of credit system.
- Returns
- true if credit system is enabled.
◆ restart()
void kanzi::connect::CreditFlowControl::restart |
( |
| ) |
|
Restores the object into state it had after construction/latest initialize() call.
calling uninitialize() will render restarting impossible.
◆ uninitialize()
void kanzi::connect::CreditFlowControl::uninitialize |
( |
| ) |
|
Uninitializes the flow control. isEnabled() will return false after calling this method.
The documentation for this class was generated from the following file:
- connect/creditflowcontrol.hpp