-
Notifications
You must be signed in to change notification settings - Fork 85
Decision router
vanilla-rtb provides developers with a set of infrastructure classes capable to help you streamline development effort.
our core and common directories have some interesting classes designed by our team to allow you configuring your logical routes when bidding on impressions.
and first implementation based on this class in our examples
used in our example for simple and most effective http_bidder capable to bid on every impression @ 50K QPS
Here is a snapshot of code with utilization of logical routes aka decisions based on outcome of actions
namespace bidder_decision_codes {
enum {EXIT=-1, USER_DATA=0, NO_BID, AUCTION_ASYNC, SIZE};
}
implementation
const decision_router_type::decision_tree_type decision_tree = {{
{bidder_decision_codes::USER_DATA, {request_user_data_f, bidder_decision_codes::AUCTION_ASYNC, bidder_decision_codes::NO_BID}},
{bidder_decision_codes::NO_BID, {no_bid_f, bidder_decision_codes::EXIT, bidder_decision_codes::EXIT}},
{bidder_decision_codes::AUCTION_ASYNC, {auction_async_f, bidder_decision_codes::EXIT, bidder_decision_codes::EXIT}}
}};
decision_router_type decision_router(decision_tree);
What you just set up are the decision routes based on outcome of function handler, provided you have configuration in JSON format , one can quickly imagine how those configuration can be loaded as decision routes in C++ code.
{
decision_routes : [
{index:0 , function:"request_user_data", true:1 , false:1},
{index:1 , function:"no_bid", true:-1 , false:-1},
{index:2 , function:"auction_async" , true:-1 , false:-1 }
]
}
This represents a very simple logic if user info available then continue bidding process and exit bidding process with bid response if user info is not available call no_bid function and exit bidding process with no bid response.
The decision trees can grow and potentially become cyclical , so we are planning to provide you with compile time recursion checks to make sure your tree does not execute same node twice therefore becoming circular.