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

#include <exchange_connector.h>

Inheritance diagram for RTBKIT::ExchangeConnector:
Datacratic::ServiceBase Datacratic::EventRecorder RTBKIT::HttpExchangeConnector DumpingExchangeConnector RTBKIT::GenericExchangeConnector RTBKIT::MockExchangeConnector RTBKIT::RubiconExchangeConnector TestRubiconExchangeConnector

List of all members.

Classes

struct  CampaignCompatibility
struct  ExchangeCompatibility

Public Types

typedef boost::function< void(std::shared_ptr
< Auction > Auction)> 
OnAuction
typedef std::function
< ExchangeConnector
*(ServiceBase *owner,
std::string name) 
Factory )

Public Member Functions

 ExchangeConnector (const std::string &name, ServiceBase &parent)
 ExchangeConnector (const std::string &name, std::shared_ptr< ServiceProxies >=std::shared_ptr< ServiceProxies >())
virtual void configure (const Json::Value &parameters)=0
virtual void start ()
virtual void shutdown ()
virtual void enableUntil (Date date)=0
virtual void setAcceptBidRequestProbability (double prob)=0
virtual std::string exchangeName () const =0
virtual ExchangeCompatibility getCampaignCompatibility (const AgentConfig &config, bool includeReasons) const
virtual ExchangeCompatibility getCreativeCompatibility (const Creative &creative, bool includeReasons) const
virtual bool bidRequestPreFilter (const BidRequest &request, const AgentConfig &config, const void *info) const
virtual bool bidRequestPostFilter (const BidRequest &request, const AgentConfig &config, const void *info) const
virtual bool bidRequestCreativeFilter (const BidRequest &request, const AgentConfig &config, const void *info) const

Static Public Member Functions

static void registerFactory (const std::string &exchange, Factory factory)
static std::unique_ptr
< ExchangeConnector
create (const std::string &exchangeType, ServiceBase &owner, const std::string &name)

Public Attributes

OnAuction onNewAuction
OnAuction onAuctionDone

Detailed Description

Base class to connect to exchanges. This class is owned by a router.

This provides: 1. Callbacks that can be used to inject an auction and a win into the router; 2. Interfaces for the router to control the exchange connector, such as cut off or throttle bids.

Definition at line 33 of file exchange_connector.h.


Member Typedef Documentation

typedef std::function<ExchangeConnector * (ServiceBase * owner, std::string name) RTBKIT::ExchangeConnector::Factory)

Type of a callback which is registered as an exchange factory.

Definition at line 289 of file exchange_connector.h.

typedef boost::function<void (std::shared_ptr<Auction> Auction)> RTBKIT::ExchangeConnector::OnAuction

Function that will be called to notify of a new auction.

Definition at line 46 of file exchange_connector.h.


Member Function Documentation

bool RTBKIT::ExchangeConnector::bidRequestCreativeFilter ( const BidRequest request,
const AgentConfig config,
const void *  info 
) const [virtual]

Filter a creative according to the exchange's filtering rules.

This function should return true if the given creative is compatible with the given bid request, and false otherwise.

Definition at line 103 of file exchange_connector.cc.

bool RTBKIT::ExchangeConnector::bidRequestPostFilter ( const BidRequest request,
const AgentConfig config,
const void *  info 
) const [virtual]

Post-filter a bid request according to the exchange's filtering rules.

This function should return true if the given bidding agent is allowed to bid on the bid request, and false otherwise. It can perform expensive computations.

In order for a bid request to pass, it will have to pass the bidRequestPreFilter AND bidRequestPostFilter functions. The only difference between the two is that the pre filter is called early in the filtering pipeline and should not do expensive computation, and the post filter is called later on (when the bid request stream has been further reduced) and can perform expensive computation.

The default implementation will return true, which implements the policy that all bid requests are compatible with all bidding agents that are compatible with the exchange (see getCampaignCompatibility() above).

Parameters:
requestThe bid request being filtered
configThe agent configuration for the agent being filtered
infoThe contents of the "info" field in the return value of getCampaignCompatibility(). This can be used to cache information to make this computation more efficient.

bidRequestPreFilter

Definition at line 94 of file exchange_connector.cc.

bool RTBKIT::ExchangeConnector::bidRequestPreFilter ( const BidRequest request,
const AgentConfig config,
const void *  info 
) const [virtual]

This is where the exchange can provide any extra filtering capability of its bid requests that is not exposed through RTBkit.

This should mostly be used to implement restrictions, for example advertiser domain restrictions that come in with the bid request.

In general, generic functionality applicable to multiple exchanges should not go here; only functionality specific to a given exchange. Pre-filter a bid request according to the exchange's filtering rules.

This function should return true if the given bidding agent is allowed to bid on the bid request, and false otherwise. It should do any work that is not expensive.

In order for a bid request to pass, it will have to pass the bidRequestPreFilter AND bidRequestPostFilter functions. The only difference between the two is that the pre filter is called early in the filtering pipeline and should not do expensive computation, and the post filter is called later on (when the bid request stream has been further reduced) and can perform expensive computation.

The default implementation will return true, which implements the policy that all bid requests are compatible with all bidding agents that are compatible with the exchange (see getCampaignCompatibility() above).

Parameters:
requestThe bid request being filtered
configThe agent configuration for the agent being filtered
infoThe contents of the "info" field in the return value of getCampaignCompatibility(). This can be used to cache information to make this computation more efficient.

bidRequestPostFilter

Definition at line 85 of file exchange_connector.cc.

virtual void RTBKIT::ExchangeConnector::configure ( const Json::Value parameters) [pure virtual]

Configure the exchange connector. The JSON provided is entirely interpreted by the exchange connector itself.

Implemented in RTBKIT::HttpExchangeConnector, and RTBKIT::MockExchangeConnector.

std::unique_ptr< ExchangeConnector > RTBKIT::ExchangeConnector::create ( const std::string &  exchangeType,
ServiceBase owner,
const std::string &  name 
) [static]

Create a new exchange connector from a factory.

Definition at line 128 of file exchange_connector.cc.

virtual void RTBKIT::ExchangeConnector::enableUntil ( Date  date) [pure virtual]

Set the time until which the exchange is enabled. Normally this will be pushed forward a few seconds periodically so that everything will shut down if there is nothing controlling the exchange connector.

Implemented in RTBKIT::HttpExchangeConnector.

virtual std::string RTBKIT::ExchangeConnector::exchangeName ( ) const [pure virtual]

Return the name of the exchange, as it would be written as an identifier.

Implemented in RTBKIT::HttpExchangeConnector, RTBKIT::GenericExchangeConnector, RTBKIT::RubiconExchangeConnector, RTBKIT::MockExchangeConnector, and DumpingExchangeConnector.

Given an agent configuration, return a structure that describes the compatibility of each campaign and creative with the exchange.

If includeReasons is true, then the reasons structure should be filled in with a list of reasons for which the exchange rejected the creative or campaign. If includeReasons is false, the reasons should be all empty to save memory allocations. Note that it doesn't make much sense to have the reasons non-empty for creatives or campaigns that are approved.

The default implementation assumes that all campaigns and creatives are compatible with the exchange.

Reimplemented in RTBKIT::HttpExchangeConnector, and RTBKIT::RubiconExchangeConnector.

Definition at line 65 of file exchange_connector.cc.

ExchangeConnector::ExchangeCompatibility RTBKIT::ExchangeConnector::getCreativeCompatibility ( const Creative creative,
bool  includeReasons 
) const [virtual]

Tell if a given creative is compatible with the given exchange. See getCampaignCompatibility().

Reimplemented in RTBKIT::HttpExchangeConnector, and RTBKIT::RubiconExchangeConnector.

Definition at line 75 of file exchange_connector.cc.

void RTBKIT::ExchangeConnector::registerFactory ( const std::string &  exchange,
Factory  factory 
) [static]

Register the given exchange factory.

Definition at line 119 of file exchange_connector.cc.

virtual void RTBKIT::ExchangeConnector::setAcceptBidRequestProbability ( double  prob) [pure virtual]

Set which percentage of bid requests will be accepted by the exchange connector.

Implemented in RTBKIT::HttpExchangeConnector.

Shutdown the exchange connector ready to be destroyed.

Reimplemented in RTBKIT::HttpExchangeConnector, and RTBKIT::GenericExchangeConnector.

Definition at line 59 of file exchange_connector.cc.

Start the exchange connector running

Reimplemented in RTBKIT::HttpExchangeConnector, and RTBKIT::MockExchangeConnector.

Definition at line 53 of file exchange_connector.cc.


Member Data Documentation

Callback for a) when there is a new auction, and b) when an auction is finished.

These are used to hook the exchange connector into the router.

Definition at line 53 of file exchange_connector.h.


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