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

#include <slave_banker.h>

Inheritance diagram for RTBKIT::SlaveBanker:
RTBKIT::Banker Datacratic::RestProxy Datacratic::MessageLoop Datacratic::Epoller Datacratic::AsyncEventSource

List of all members.

Public Member Functions

 SlaveBanker (std::shared_ptr< zmq::context_t > context)
 SlaveBanker (std::shared_ptr< zmq::context_t > context, std::shared_ptr< ConfigurationService > config, const std::string &accountSuffix, const std::string &bankerServiceClass="rtbBanker")
void init (std::shared_ptr< ConfigurationService > config, const std::string &accountSuffix, const std::string &serviceClass="rtbBanker")
virtual void addSpendAccount (const AccountKey &account, CurrencyPool accountFloat, std::function< void(std::exception_ptr, ShadowAccount &&)> onDone)
ShadowAccount getAccount (const AccountKey &account)
virtual bool authorizeBid (const AccountKey &account, const std::string &item, Amount amount)
virtual void commitBid (const AccountKey &account, const std::string &item, Amount amountPaid, const LineItems &lineItems)
virtual Amount detachBid (const AccountKey &account, const std::string &item)
virtual void attachBid (const AccountKey &account, const std::string &item, Amount amountAuthorized)
virtual void commitDetachedBid (const AccountKey &account, Amount amountAuthorized, Amount amountPaid, const LineItems &lineItems)
virtual void forceWinBid (const AccountKey &account, Amount amountPaid, const LineItems &lineItems)
ShadowAccount syncAccountSync (const AccountKey &account)
void syncAccount (const AccountKey &account, std::function< void(std::exception_ptr, ShadowAccount &&)> onDone)
void syncAllSync ()
void syncAll (std::function< void(std::exception_ptr)> onDone=std::function< void(std::exception_ptr)>())
ShadowAccount getAccountStateDebug (AccountKey accountKey) const
virtual void logBidEvents (const Datacratic::EventRecorder &eventRecorder)

Detailed Description

Banker object that operates as a slave of the master banker. Splits a big block of budget into individual auctions and keeps track of what has been committed so far.

Definition at line 87 of file slave_banker.h.


Member Function Documentation

void RTBKIT::SlaveBanker::addSpendAccount ( const AccountKey account,
CurrencyPool  accountFloat,
std::function< void(std::exception_ptr, ShadowAccount &&)>  onDone 
) [virtual]

Notify the banker that we're going to need to be spending some money for the given account. We also keep track of how much "float" we try to maintain for the account.

Reimplemented from RTBKIT::Banker.

Definition at line 410 of file slave_banker.cc.

virtual void RTBKIT::SlaveBanker::commitBid ( const AccountKey account,
const std::string &  item,
Amount  amountPaid,
const LineItems lineItems 
) [inline, virtual]

Commit a bid. This is used internally to both cancel and win bids. Asynchonous and returns no value.

Implements RTBKIT::Banker.

Definition at line 134 of file slave_banker.h.

Testing only: get the internal state of an account.

Definition at line 192 of file slave_banker.h.

void RTBKIT::SlaveBanker::init ( std::shared_ptr< ConfigurationService config,
const std::string &  accountSuffix,
const std::string &  serviceClass = "rtbBanker" 
)

Initialize the slave banker. This will connect it to the master banker (that it will discover using the configuration service under the bankerServiceName).

The accountSuffix parameter is used to name spend accounts underneath the given budget accounts (to disambiguate between multiple accessors of those accounts). It must be unique across the entire system, but should be consistent from one invocation to another.

Definition at line 174 of file slave_banker.cc.

void RTBKIT::SlaveBanker::syncAccount ( const AccountKey account,
std::function< void(std::exception_ptr, ShadowAccount &&)>  onDone 
)

Sync the account asynchronously, calling the given callback once synchronization is done.

Definition at line 309 of file slave_banker.cc.

Sync the given account synchronously, returning the new status of the account.

Definition at line 240 of file slave_banker.cc.

void RTBKIT::SlaveBanker::syncAll ( std::function< void(std::exception_ptr)>  onDone = std::function<void (std::exception_ptr)>())

Synchronize all accounts asynchronously.

Definition at line 342 of file slave_banker.cc.

Synchronize all accounts synchronously.

Definition at line 333 of file slave_banker.cc.


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