![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <slave_banker.h>
Public Member Functions | |
void | init (std::shared_ptr< ConfigurationService > config, const std::string &serviceClass="rtbBanker") |
virtual void | addAccount (const AccountKey &account, const OnBudgetResult &onResult) |
virtual void | topupTransfer (const AccountKey &account, CurrencyPool amount, const OnBudgetResult &onResult) |
virtual void | setBudget (const std::string &topLevelAccount, CurrencyPool amount, const OnBudgetResult &onResult) |
virtual void | addBudget (const std::string &topLevelAccount, CurrencyPool amount, const OnBudgetResult &onResult) |
virtual void | getAccountList (const AccountKey &prefix, int depth, std::function< void(std::exception_ptr, std::vector< AccountKey > &&)> onResult) |
virtual void | getAccountSummary (const AccountKey &account, int depth, std::function< void(std::exception_ptr, AccountSummary &&)> onResult) |
virtual void | getAccount (const AccountKey &account, std::function< void(std::exception_ptr, Account &&)> onResult) |
Static Public Member Functions | |
static OnDone | budgetResultCallback (const OnBudgetResult &onResult) |
Budget controller object that operates as a slave of the master banker.
Definition at line 27 of file slave_banker.h.
void RTBKIT::SlaveBudgetController::addAccount | ( | const AccountKey & | account, |
const OnBudgetResult & | onResult | ||
) | [virtual] |
Add an account to the system. If it already exists, nothing is done.
A newly added account starts with a zero budget.
Reimplemented from RTBKIT::BudgetController.
Definition at line 29 of file slave_banker.cc.
void RTBKIT::SlaveBudgetController::addBudget | ( | const std::string & | topLevelAccount, |
CurrencyPool | amount, | ||
const OnBudgetResult & | onResult | ||
) | [virtual] |
Add to the budget for an existing campaign. If the campaign does not exist it is created with an initial amount set to the amount specified
campaign | The campaign whose budget we want to add to |
amount | The amount(in micro$) that we want to add to the budget |
If the campaign does not exist it will be created
BankerException | with error to set LOWER_THAN_TRANSFERRED if the amount specified is lower than the amount already spent in the campaign |
BankerException | with error to set MAX_EXCEEDED if the amount specified is more than the maximum currently allowed |
Reimplemented from RTBKIT::BudgetController.
Definition at line 65 of file slave_banker.cc.
void RTBKIT::SlaveBudgetController::init | ( | std::shared_ptr< ConfigurationService > | config, |
const std::string & | serviceName = "rtbBanker" |
||
) | [inline] |
Initialize and connect to the given service on the "zeromq" endpoint.
Reimplemented from Datacratic::RestProxy.
Definition at line 37 of file slave_banker.h.
void RTBKIT::SlaveBudgetController::setBudget | ( | const std::string & | topLevelAccount, |
CurrencyPool | amount, | ||
const OnBudgetResult & | onResult | ||
) | [virtual] |
Set the budget for a given campaign to the specified amount
campaign | The campaign whose budget we want to set |
amount | The amount(in micro$) that we want to set the budget to |
If the campaign does not exist it will be created
BankerException | with error to set LOWER_THAN_TRANSFERRED if the amount specified is lower than the amount already spent in the campaign |
BankerException | with error to set MAX_EXCEEDED if the amount specified is more than the maximum currently allowed |
Reimplemented from RTBKIT::BudgetController.
Definition at line 53 of file slave_banker.cc.
void RTBKIT::SlaveBudgetController::topupTransfer | ( | const AccountKey & | account, |
CurrencyPool | amount, | ||
const OnBudgetResult & | onResult | ||
) | [virtual] |
The amount here refers to an absolute amount that the strategy should have. This method transfers the appropriate amount so that the strategy ends up with the specified amount
campaign | The campaign to which we want to add our strategy |
strategy | The name of the strategy |
amount | The amount that the strategy should have after the transfer |
BankerException | with error set to INSUFFICIENT_FUNDS if the amount to transfer exceeds the amount available |
Reimplemented from RTBKIT::BudgetController.
Definition at line 41 of file slave_banker.cc.