![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <auction.h>
Classes | |
struct | Data |
struct | Price |
struct | Response |
Public Types | |
enum | WinLoss { PENDING, WIN, LOSS, TOOLATE, INVALID } |
typedef boost::function< void(std::shared_ptr < Auction > auction)> | HandleAuction |
Public Member Functions | |
Auction (ExchangeConnector *exchangeConnector, HandleAuction handleAuction, std::shared_ptr< BidRequest > request, const std::string &requestStr, const std::string &requestStrFormat, Date start, Date expiry) | |
double | timeAvailable (Date now=Date::now()) const |
double | timeUsed (Date now=Date::now()) const |
bool | tooLate () |
WinLoss | setResponse (int spotNum, Response newResponse) |
void | addDataSources (const std::set< std::string > &sources) |
const std::set< std::string > & | getDataSources () const |
std::string | status () const |
bool | setError (const std::string &error, const std::string &details="") |
bool | finish () |
size_t | numSpots () const |
Json::Value | getResponseJson (int spotNum) const |
Json::Value | getResponsesJson () const |
const std::vector< std::vector < Response > > & | getResponses () const |
const Data * | getCurrentData () const |
Public Attributes | |
bool | isZombie |
Auction was externally cancelled. | |
Date | start |
Date | expiry |
Date | lossAssumed |
Date | doneParsing |
Date | inPrepro |
Date | outOfPrepro |
Date | doneAugmenting |
Date | inStartBidding |
Id | id |
std::shared_ptr< BidRequest > | request |
std::string | requestStr |
Stringified version of request. | |
std::string | requestStrFormat |
Format of stringified request. | |
std::string | requestSerialized |
Serialized bid request (canonical) | |
AugmentationList | augmentations |
Aggregate aug info for all agents. | |
AgentAugmentations | agentAugmentations |
per agent augmentations. | |
ExchangeConnector * | exchangeConnector |
Exchange connector for auction. | |
HandleAuction | handleAuction |
Callback for when auction is finished. | |
Static Public Attributes | |
static const Price | NONE |
static long long | created = 0 |
Memory leak tracking. | |
static long long | destroyed = 0 |
This is the object that represents an in-flight auction to the router. Agents modify this object in order to set their bids.
typedef boost::function<void (std::shared_ptr<Auction> auction)> RTBKIT::Auction::HandleAuction |
void RTBKIT::Auction::addDataSources | ( | const std::set< std::string > & | sources | ) |
Merges the given data sources used to make the bidding decision with the ones already already present in the auction.
Thread safe.
Definition at line 298 of file auction.cc.
bool RTBKIT::Auction::finish | ( | ) |
Finish the auction. This will call the auction handler. The return value is true if finish() was actually called, or false if it was previously finished by something else.
Definition at line 333 of file auction.cc.
Json::Value RTBKIT::Auction::getResponseJson | ( | int | spotNum | ) | const |
Return a JSON representation of the response.
Definition at line 428 of file auction.cc.
const std::vector< std::vector< Auction::Response > > & RTBKIT::Auction::getResponses | ( | ) | const |
Get the wins, winning first and than any losing bids afterwards. The auction should be over before this is called.
Definition at line 290 of file auction.cc.
Json::Value RTBKIT::Auction::getResponsesJson | ( | ) | const |
Return all responses as JSON.
size_t RTBKIT::Auction::numSpots | ( | ) | const [inline] |
bool RTBKIT::Auction::setError | ( | const std::string & | error, |
const std::string & | details = "" |
||
) |
Set an error flag on the auction, which will cause the response to reflect this error. Also finishes the auction.
Definition at line 366 of file auction.cc.
Auction::WinLoss RTBKIT::Auction::setResponse | ( | int | spotNum, |
Response | newResponse | ||
) |
Modify the given response. The boolean return code says whether or not this response was accepted (due to it being the maximum-priority response).
Returns the (local) status of the response.
Thread safe.
Definition at line 238 of file auction.cc.
std::string RTBKIT::Auction::status | ( | ) | const |
Return a status that can be used for debugging.
Definition at line 406 of file auction.cc.
double RTBKIT::Auction::timeAvailable | ( | Date | now = Date::now() | ) | const |
How much time is still available for the auction (in seconds).
Definition at line 224 of file auction.cc.
double RTBKIT::Auction::timeUsed | ( | Date | now = Date::now() | ) | const |
How much time has been used by the auction (in seconds).
Definition at line 231 of file auction.cc.
bool RTBKIT::Auction::tooLate | ( | ) |
If this value is set, then the bid has already been sent of and it's too late to modify the object any more.
Definition at line 399 of file auction.cc.
const Auction::Price RTBKIT::Auction::NONE [static] |