![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
Public Member Functions | |
void | onGotTransport () |
virtual void | handleHttpPayload (const HttpHeader &header, const std::string &payload) |
virtual void | handleDisconnect () |
void | cancelTimer () |
virtual void | sendErrorResponse (const std::string &error, const std::string &details="") |
virtual void | dropAuction (const std::string &reason="") |
virtual void | handleTimeout (Date date, size_t cookie) |
virtual void | onDisassociate () |
virtual void | onCleanup () |
virtual std::string | status () const |
void | doEvent (const char *eventName, EventType type=ET_COUNT, float value=1.0, const char *units="") |
void | incNumServingRequest () |
virtual void | sendResponse () |
virtual HttpResponse | getResponse () const |
virtual std::shared_ptr < BidRequest > | parseBidRequest (const HttpHeader &header, const std::string &payload) |
virtual double | getTimeAvailableMs (const HttpHeader &header, const std::string &payload) |
virtual double | getRoundTripTimeMs (const HttpHeader &header) |
Public Attributes | |
HttpExchangeConnector * | endpoint |
std::shared_ptr< Auction > | auction |
bool | hasTimer |
bool | disconnected |
bool | servingRequest |
Are we currently, actively serving a request? | |
Static Public Attributes | |
static long | created = 0 |
static long | destroyed = 0 |
Definition at line 23 of file http_auction_handler.h.
Cancel the timer for this connection if it exists.
Reimplemented from Datacratic::ConnectionHandler.
Definition at line 115 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::doEvent | ( | const char * | eventName, |
EventType | type = ET_COUNT , |
||
float | value = 1.0 , |
||
const char * | units = "" |
||
) |
Record an event that will be stored in the operational events table.
Definition at line 160 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::dropAuction | ( | const std::string & | reason = "" | ) | [virtual] |
Drop the auction. Mostly when there simply isn't enough time to do anything useful.
Definition at line 443 of file http_auction_handler.cc.
HttpResponse RTBKIT::HttpAuctionHandler::getResponse | ( | ) | const [virtual] |
Return a stringified JSON of the response for our auction. Default implementation calls getResponse() and stringifies the result.
This version is provided as it may be more efficient in terms of memory allocations.
Default implementation forwards to the endpoint.
Definition at line 485 of file http_auction_handler.cc.
double RTBKIT::HttpAuctionHandler::getRoundTripTimeMs | ( | const HttpHeader & | header | ) | [virtual] |
Return an estimate of how long a round trip with the connected server takes, in milliseconds at the exchange's latency percentile.
Default implementation forwards to the endpoint.
Definition at line 508 of file http_auction_handler.cc.
double RTBKIT::HttpAuctionHandler::getTimeAvailableMs | ( | const HttpHeader & | header, |
const std::string & | payload | ||
) | [virtual] |
Return the available time for the bid request in milliseconds. This method should not parse the bid request, as when shedding load we want to do as little work as possible.
Most exchanges include this information in the HTTP headers.
Default implementation forwards to the endpoint.
Definition at line 500 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::handleDisconnect | ( | ) | [virtual] |
Got a disconnection
Reimplemented from Datacratic::ConnectionHandler.
Definition at line 77 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::handleHttpPayload | ( | const HttpHeader & | header, |
const std::string & | payload | ||
) | [virtual] |
Called once the entire payload has come through. Default will throw. Will be called multiple times for chunked encoding.
Reimplemented from Datacratic::HttpConnectionHandler.
Definition at line 178 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::onCleanup | ( | ) | [virtual] |
Function called out to to clean up before we finish for whatever reason.
Reimplemented from Datacratic::HttpConnectionHandler.
Definition at line 153 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::onDisassociate | ( | ) | [virtual] |
Function called when we're dissociating the connection.
Reimplemented from Datacratic::ConnectionHandler.
Definition at line 128 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::onGotTransport | ( | ) | [virtual] |
We got our transport.
Reimplemented from Datacratic::HttpConnectionHandler.
Definition at line 56 of file http_auction_handler.cc.
std::shared_ptr< BidRequest > RTBKIT::HttpAuctionHandler::parseBidRequest | ( | const HttpHeader & | header, |
const std::string & | payload | ||
) | [virtual] |
Parse the given payload into a bid request.
Default implementation forwards to the endpoint.
Definition at line 492 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::sendErrorResponse | ( | const std::string & | error, |
const std::string & | details = "" |
||
) | [virtual] |
Send over an error response. Mostly used when the bid request had an error.
Definition at line 462 of file http_auction_handler.cc.
void RTBKIT::HttpAuctionHandler::sendResponse | ( | ) | [virtual] |
Function called once the auction is finished. It causes the response in the auction to be formatted and sent back to the exchange.
Definition at line 356 of file http_auction_handler.cc.