RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions
RTBKIT::SlaveBudgetController Struct Reference

#include <slave_banker.h>

Inheritance diagram for RTBKIT::SlaveBudgetController:
RTBKIT::BudgetController RTBKIT::Accountant Datacratic::RestProxy Datacratic::MessageLoop Datacratic::Epoller Datacratic::AsyncEventSource

List of all members.

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)

Detailed Description

Budget controller object that operates as a slave of the master banker.

Definition at line 27 of file slave_banker.h.


Member Function Documentation

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

Parameters:
campaignThe campaign whose budget we want to add to
amountThe amount(in micro$) that we want to add to the budget

If the campaign does not exist it will be created

Exceptions:
BankerExceptionwith error to set LOWER_THAN_TRANSFERRED if the amount specified is lower than the amount already spent in the campaign
BankerExceptionwith 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

Parameters:
campaignThe campaign whose budget we want to set
amountThe amount(in micro$) that we want to set the budget to

If the campaign does not exist it will be created

Exceptions:
BankerExceptionwith error to set LOWER_THAN_TRANSFERRED if the amount specified is lower than the amount already spent in the campaign
BankerExceptionwith 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

Parameters:
campaignThe campaign to which we want to add our strategy
strategyThe name of the strategy
amountThe amount that the strategy should have after the transfer
Exceptions:
BankerExceptionwith 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.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator