RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
Classes | Typedefs | Enumerations | Functions | Variables
RTBKIT Namespace Reference

Classes

struct  AccountKey
struct  Auction
struct  SubmittedAuctionEvent
struct  PostAuctionEvent
struct  CampaignEvent
struct  CampaignEvents
struct  DeliveryEvent
struct  Augmentation
struct  AugmentationList
struct  FormatSetDescription
struct  UserIdsDescription
struct  Format
struct  FormatSet
struct  AdSpot
struct  UserIds
struct  Location
struct  BidRequest
struct  Bid
struct  Bids
struct  BidResult
struct  LineItemsDescription
struct  AmountDescription
struct  CurrencyPoolDescription
struct  CurrencyCodeDescription
struct  Amount
struct  MicroUSD
struct  USD
struct  USD_CPM
struct  MicroUSD_CPM
struct  CurrencyPool
struct  LineItems
struct  ExchangeConnector
struct  JsonHolder
struct  SegmentsBySourceValueDescription
struct  SegmentList
struct  SegmentsBySource
struct  Tag
struct  Tags
struct  TagFilter
struct  TagFilterExpression
struct  Creative
struct  UserPartition
struct  AgentConfig
struct  AgentConfigEntry
struct  AllAgentConfig
struct  AgentConfigurationListener
struct  AgentConfigurationService
struct  BlacklistInfo
struct  Blacklist
struct  JsonPrint
struct  CachedRegex
struct  DomainMatcher
struct  IncludeExclude
struct  Account
struct  ShadowAccount
struct  AccountSummary
struct  Accounts
struct  ShadowAccounts
struct  BankerSyncResult
struct  BankerSyncResult< void >
struct  BudgetController
struct  Accountant
class  Banker
struct  BankerException
struct  BankerPersistence
struct  NoBankerPersistence
struct  RedisBankerPersistence
struct  OldRedisBankerPersistence
struct  MasterBanker
struct  RedisMigration
struct  Campaign
struct  Strategy
struct  RedisRollback
struct  NullBudgetController
class  NullBanker
struct  NullAccountant
struct  SlaveBudgetController
struct  SlaveBanker
struct  BankerTemporaryServer
struct  MockBankerPersistence
struct  MonitorClient
struct  MonitorEndpoint
struct  MonitorProvider
struct  MonitorProviderClient
struct  MockMonitorProvider
struct  SubmissionInfo
struct  FinishedInfo
struct  PostAuctionLoop
struct  AugmentorInfo
struct  AugmentationInfo
struct  AugmentationLoop
struct  RouterProfiler
struct  AgentInfoEntry
struct  AllAgentInfo
struct  AuctionDebugInfo
struct  Router
struct  RouterRestApiConnection
struct  RouterRunner
struct  RouterStack
struct  BiddableSpots
struct  AgentStats
struct  AgentStatus
struct  AgentInfo
 Information about a agent. More...
struct  PotentialBidder
struct  GroupPotentialBidders
struct  AuctionInfoBase
struct  BidInfo
struct  AuctionInfo
struct  FormatInfo
struct  DutyCycleEntry
struct  FrequencyCapStorage
struct  FrequencyCapAugmentor
struct  FixedPriceBiddingAgent
struct  MockAdServerConnector
struct  MockExchangeConnector
struct  AdServerConnector
struct  HttpAdServerConnectionHandler
struct  HttpAdServerHttpEndpoint
struct  HttpAdServerConnector
struct  AugmentationRequest
struct  Augmentor
struct  MultiThreadedAugmentor
struct  SyncAugmentor
struct  AsyncAugmentor
struct  OpenRtbBidRequestParser
struct  BiddingAgent
struct  DataLogger
struct  HttpAuctionHandler
struct  HttpExchangeConnector
struct  RubiconExchangeConnector
struct  GenericExchangeConnector
struct  MockExchange
struct  TestAgent

Typedefs

typedef std::vector< std::string > AccountKeyBase
typedef std::map< std::string,
std::string > 
AgentAugmentations
typedef std::map< AccountKey,
Augmentation
AugmentationListBase
typedef ML::compact_vector
< uint16_t, 5, uint16_t > 
SmallIntVector
typedef ML::compact_vector
< uint32_t, 3, uint32_t > 
IntVector
typedef std::map< std::string,
std::shared_ptr< SegmentList > > 
SegmentsBySourceBase
typedef std::unordered_map
< std::string, Campaign
Campaigns
typedef std::unordered_map
< std::string, Strategy
Strategies
typedef HttpMonitor
< RouterRestApiConnection,
Router * > 
RouterRestApi
typedef ML::compact_vector
< std::pair< int,
SmallIntVector >, 3, uint32_t > 
BiddableSpotsBase
typedef std::function< void(const
HttpHeader &header, const
Json::Value &json, const
std::string &jsonStr)> 
HttpAdServerRequestCb

Enumerations

enum  PostAuctionEventType { PAE_INVALID, PAE_WIN, PAE_LOSS, PAE_CAMPAIGN_EVENT }
enum  IdDomain { ID_PROVIDER, ID_EXCHANGE, ID_MAX }
enum  BidStatus {
  BS_WIN, BS_LOSS, BS_TOOLATE, BS_INVALID,
  BS_LOSTBID, BS_DROPPEDBID, BS_NOBUDGET
}
enum  CurrencyCode { CC_NONE = 'N' << 24 | 'O' << 16 | 'N' << 8 | 'E', CC_USD = 'U' << 24 | 'S' << 16 | 'D' << 8 | 0 }
enum  SegmentResult { SEG_NOT_PRESENT, SEG_PRESENT, SEG_MISSING }
 Result of querying for segment presence. More...
enum  BlacklistType { BL_OFF, BL_USER, BL_USER_SITE }
enum  BlacklistScope { BL_AGENT, BL_ACCOUNT }
enum  BidControlType { BC_RELAY, BC_RELAY_FIXED, BC_FIXED }
enum  BidResultFormat { BRF_FULL, BRF_LIGHTWEIGHT, BRF_NONE }
enum  IncludeExcludeResult { IE_NO_DATA, IE_NOT_INCLUDED, IE_EXCLUDED, IE_PASSED }
enum  AccountType { AT_NONE, AT_BUDGET, AT_SPEND }
enum  BankerError {
  INVALID_CAMPAIGN, CAMPAIGN_NOT_FOUND, STRATEGY_NOT_FOUND, INVALID_STRATEGY,
  INSUFFICIENT_FUNDS, LOWER_THAN_TRANSFERRED, EXCEEDS_MAX, TOO_LOW,
  ACCOUNTING_MISMATCH, DATABASE_ERROR
}
enum  { QueueSize = 65536 }

Functions

void validateSlug (const std::string &slug)
std::ostream & operator<< (std::ostream &stream, const AccountKey &key)
 COMPACT_PERSISTENT_ENUM_IMPL (PostAuctionEventType)
const char * print (PostAuctionEventType type)
 COMPACT_PERSISTENT_ENUM_DECL (PostAuctionEventType)
std::ostream & operator<< (std::ostream &stream, const PostAuctionEvent &event)
ML::DB::Store_Writer & operator<< (ML::DB::Store_Writer &store, std::shared_ptr< PostAuctionEvent > event)
ML::DB::Store_Reader & operator>> (ML::DB::Store_Reader &store, std::shared_ptr< PostAuctionEvent > &event)
bool isEmpty (const std::string &str)
bool isEmpty (const Json::Value &val)
bool isEmpty (const Utf8String &str)
template<typename T >
void addIfNotEmpty (Json::Value &obj, const std::string &key, const T &val)
template<typename T >
void addIfNotEmpty (Json::Value &obj, const std::string &key, const T &val, const T &emptyVal)
void addIfNotEmpty (Json::Value &obj, const std::string &key, const Url &url)
void addIfNotEmpty (Json::Value &obj, const std::string &key, const std::vector< CurrencyCode > &curr)
ValueDescriptionT
< RTBKIT::FormatSet > * 
getDefaultDescription (RTBKIT::FormatSet *)
std::string formatDims (const SmallIntVector &dims)
ValueDescriptionT
< RTBKIT::UserIds > * 
getDefaultDescription (RTBKIT::UserIds *)
template<typename T >
void toJsonValue (Json::Value &v, const T &val)
template<typename T >
void fromJsonOptional (const Json::Value &val, std::unique_ptr< T > &ptr, Json::Value &unparseable, std::string key)
ML::DB::Store_Writer & operator<< (ML::DB::Store_Writer &store, const Json::Value &val)
ML::DB::Store_Reader & operator>> (ML::DB::Store_Reader &store, Json::Value &val)
 IMPL_SERIALIZE_RECONSTITUTE (Format)
 IMPL_SERIALIZE_RECONSTITUTE (FormatSet)
 IMPL_SERIALIZE_RECONSTITUTE (AdSpot)
 IMPL_SERIALIZE_RECONSTITUTE (UserIds)
 IMPL_SERIALIZE_RECONSTITUTE (Location)
 IMPL_SERIALIZE_RECONSTITUTE (BidRequest)
const char * bidStatusToChar (BidStatus status)
BidStatus bidStatusFromString (const std::string &str)
std::string bidStatusToString (BidStatus status)
std::string toString (CurrencyCode code)
CurrencyCode parseCurrencyCode (const std::string &code)
CurrencyCode jsonDecode (const Json::Value &j, CurrencyCode *)
Json::Value jsonEncode (CurrencyCode code)
std::ostream & operator<< (std::ostream &stream, Amount amount)
std::ostream & operator<< (std::ostream &stream, CurrencyPool pool)
ValueDescriptionT< LineItems > * getDefaultDescription (LineItems *)
ValueDescriptionT< CurrencyPool > * getDefaultDescription (CurrencyPool *)
ValueDescriptionT< Amount > * getDefaultDescription (Amount *)
ValueDescriptionT< CurrencyCode > * getDefaultDescription (CurrencyCode *)
 IMPL_SERIALIZE_RECONSTITUTE (Amount)
 IMPL_SERIALIZE_RECONSTITUTE (CurrencyPool)
std::ostream & operator<< (std::ostream &stream, const LineItems &li)
 IMPL_SERIALIZE_RECONSTITUTE (LineItems)
std::ostream & operator<< (std::ostream &stream, const JsonHolder &json)
 IMPL_SERIALIZE_RECONSTITUTE (JsonHolder)
zmq::message_t encodeMessage (const JsonHolder &j)
int toInt (const std::string &str)
long toLong (const std::string &str)
double toDouble (const std::string &str)
std::string toString (double d)
std::string toString (int i)
std::string toString (signed long l)
std::string toString (unsigned long l)
template<typename Seq1 , typename Seq2 >
bool anyMatchesLookup (const Seq1 &seq1, const Seq2 &seq2)
template<typename Seq1 , typename Seq2 >
bool anyMatches (const Seq1 &seq1, const Seq2 &seq2)
ValueDescriptionT
< RTBKIT::SegmentsBySource > * 
getDefaultDescription (RTBKIT::SegmentsBySource *)
 IMPL_SERIALIZE_RECONSTITUTE (SegmentList)
std::ostream & operator<< (std::ostream &stream, const SegmentList &segs)
 IMPL_SERIALIZE_RECONSTITUTE (SegmentsBySource)
Json::Value jsonPrint (const Creative &c)
uint64_t calcMd5 (const std::string &str)
Json::Value toJson (BidResultFormat fmt)
void fromJson (BidResultFormat &fmt, const Json::Value &j)
std::string jsonToString (const Json::Value &value)
void jsonParse (const Json::Value &value, boost::u32regex &rex)
void jsonParse (const Json::Value &value, boost::regex &rex)
void jsonParse (const Json::Value &value, std::string &str)
void jsonParse (const Json::Value &value, int &i)
bool matchesAnyAny (const std::vector< int > &values, const SegmentList &vals, bool matchIfEmpty)
template<typename T >
bool matches (const T &t1, const T &t2)
bool matches (const boost::u32regex &rex, const Utf8String &val)
bool matches (const boost::regex &rex, const std::string &val)
Json::Value jsonPrint (const boost::regex &rex)
Json::Value jsonPrint (const boost::u32regex &rex)
Json::Value jsonPrint (const std::string &str)
Json::Value jsonPrint (int i)
uint64_t hashString (const std::string &str)
uint64_t hashString (const Utf8String &str)
uint64_t hashString (const std::wstring &str)
void createRegex (boost::u32regex &regex, const wchar_t *str)
void createRegex (boost::regex &regex, const std::string &str)
template<typename Base , typename Str >
void jsonParse (const Json::Value &value, CachedRegex< Base, Str > &rex)
template<typename Base , typename Str >
Json::Value jsonPrint (const CachedRegex< Base, Str > &rex)
template<typename Base , typename Str , typename Cache >
bool matches (const CachedRegex< Base, Str > &rex, const Str &str, uint64_t strHash, Cache &cache)
template<typename Base , typename Str >
bool matches (const CachedRegex< Base, Str > &rex, const Str &str)
void jsonParse (const Json::Value &value, DomainMatcher &rex)
Json::Value jsonPrint (const DomainMatcher &rex)
template<typename Cache >
bool matches (const DomainMatcher &rex, const Url &url, uint64_t urlHash, Cache &cache)
bool matches (const DomainMatcher &rex, const Url &url)
template<typename T , typename Fn >
Json::Value collectionToJson (const std::vector< T > &vec, Fn fn)
template<typename T , typename Fn >
Json::Value collectionToJson (const std::set< T > &s, Fn fn)
template<typename Collection , typename Fn >
Json::Value includeExcludeToJson (const Collection &include, const Collection &exclude, Fn fn)
template<typename T , typename U >
bool matchesAny (const std::vector< T > &values, const U &key, bool matchIfEmpty)
template<typename T , typename U , typename Cache >
bool matchesAny (const std::vector< T > &values, const U &key, uint64_t keyHash, bool matchIfEmpty, Cache &cache)
template<typename T , class Vec >
bool matchesAnyAny (const std::vector< T > &values, const Vec &vec, bool matchIfEmpty)
template<typename U , typename IE >
bool isIncludedImpl (const U &value, const IE &include, const IE &exclude)
template<typename U , typename IE , typename Cache >
bool isIncludedImpl (const U &value, uint64_t hash, const IE &include, const IE &exclude, Cache &cache)
template<typename Vec , typename IE >
bool anyIsIncludedImpl (const Vec &vec, const IE &include, const IE &exclude)
AccountType AccountTypeFromString (const std::string &param)
const std::string AccountTypeToString (enum AccountType type)
std::ostream & operator<< (std::ostream &stream, const Account &account)
std::ostream & operator<< (std::ostream &stream, const ShadowAccount &account)
AccountType restDecode (const std::string &param, AccountType *)
std::ostream & operator<< (std::ostream &stream, const AccountSummary &summary)
AccountKey restDecode (const std::string &str, AccountKey *)
std::string restEncode (const AccountKey &val)
bool GetRedisReplyAsInt (const Reply &reply, long long int &value)
 IMPL_SERIALIZE_RECONSTITUTE (FinishedInfo::Visit)
template<typename Value >
bool findAuction (PendingList< pair< Id, Id >, Value > &pending, const Id &auctionId)
template<typename Value >
bool findAuction (PendingList< pair< Id, Id >, Value > &pending, const Id &auctionId, Id &adSpotId, Value &val)
double getProfilingTime ()
int64_t microsecondsBetween (double after, double before)
std::string chomp (const std::string &s)
std::string reduceUrl (const Url &url)
BidRequestfromOpenRtb (OpenRTB::BidRequest &&req, const std::string &provider, const std::string &exchange)
void sendMesg (zmq::socket_t &sock, const Id &id, int options=0)
 BOOST_STATIC_ASSERT (hasFromJson< Datacratic::Id >::value==true)
 BOOST_STATIC_ASSERT (hasFromJson< int >::value==false)
 for (size_t i=0;i< payload["imp"].size();++i)
return make_pair (true, bids)
 bids (bidPort, id)
 wins (winPort)
 rng (random())

Variables

const string CampaignsPrefix = "campaigns:"
auto vector< Bid > Json::Value payload
vector< Bidbids

Detailed Description

augmentation.h -*- C++ -*- Rémi Attab, 05 Dec 2012 Copyright (c) 2012 Datacratic. All rights reserved.

Structures used to manipulate augmentations.

router_runner.h -*- C++ -*- Jeremy Barnes, 17 December 2012 Copyright (c) 2012 Datacratic. All rights reserved.

Program to run the router.

augmentor_ex.h -*- C++ -*- Rémi Attab, 22 Feb 2013 Copyright (c) 2013 Datacratic. All rights reserved.

Interface of our Augmentor example for an extremely simple frequency cap service.

Note that this header exists mainly so that it can be integrated into the rtbkit_integration_test. Most of the documentation for it is in the cc file.

ad_server_connector_ex.cc -*- C++ -*- Eric Robert, 03 April 2013 Copyright (c) 2013 Datacratic. All rights reserved.

Example of a simple ad server connector.

mock_exchange.h -*- C++ -*- Rémi Attab, 18 Feb 2013 Copyright (c) 2013 Datacratic. All rights reserved.

Mock exchanges used for testing various types of bid request behaviours.

Todo:
This a work in progress that needs to be generic-ified.

Typedef Documentation

typedef std::map<std::string, std::string> RTBKIT::AgentAugmentations

Agent name to stringified augemntation. In other words, it's a collapsed version of the AumgnetationList structure.

Definition at line 51 of file augmentation.h.


Enumeration Type Documentation

Enumerator:
AT_BUDGET 

Budgeting account.

AT_SPEND 

Spend tracking account; leaf.

Definition at line 43 of file account.h.

Enumerator:
BC_RELAY 

Relay to agent which will compute the price.

BC_RELAY_FIXED 

Relay to agent but bid fixed price.

BC_FIXED 

Bid fixed price and don't relay.

Definition at line 177 of file agent_config.h.

Enumerator:
BRF_FULL 

Full message.

BRF_LIGHTWEIGHT 

Lightweight message.

BRF_NONE 

No message.

Definition at line 188 of file agent_config.h.

Enumerator:
BS_WIN 

Bid was won.

BS_LOSS 

Bid was lost.

BS_TOOLATE 

Bid was too late and so not accepted.

BS_INVALID 

Bid was invalid and so not accepted.

BS_LOSTBID 

Bid was lost somewhere.

BS_DROPPEDBID 

Bid was dropped as way too late.

BS_NOBUDGET 

No budget.

Definition at line 26 of file bids.h.

Enumerator:
BL_AGENT 

Blacklist for the agent.

BL_ACCOUNT 

Blacklist for an account.

Definition at line 167 of file agent_config.h.

Enumerator:
BL_OFF 

Don't blacklist.

BL_USER 

Blacklist the user.

BL_USER_SITE 

Blacklist the user on the given site.

Definition at line 161 of file agent_config.h.

A set of IDs broken out that can be accessed very efficiently.

Definition at line 168 of file bid_request.h.

Result of querying for segment presence.

Enumerator:
SEG_NOT_PRESENT 

Segment is not present.

SEG_PRESENT 

Segment is present.

SEG_MISSING 

Segment is missing.

Definition at line 19 of file segments.h.


Function Documentation

int64_t RTBKIT::microsecondsBetween ( double  after,
double  before 
) [inline]

Microseconds between the two times, which are expressed in seconds.

Definition at line 26 of file profiler.h.

void RTBKIT::validateSlug ( const std::string &  slug)

Validate the the given name (campaign or strategy) is valid for our system, that is composed of the following:

  • Uppercase or lowercase letters
  • numerals
  • underscores
  • maximum length of 64 characters
  • not null

Definition at line 17 of file account_key.cc.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator