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 | Protected Member Functions | Protected Attributes
Datacratic::RestProxy Struct Reference

#include <rest_proxy.h>

Inheritance diagram for Datacratic::RestProxy:
Datacratic::MessageLoop Datacratic::Epoller Datacratic::AsyncEventSource RTBKIT::MonitorClient RTBKIT::MonitorProviderClient RTBKIT::SlaveBanker RTBKIT::SlaveBudgetController

List of all members.

Classes

struct  Operation

Public Types

typedef std::function< void(std::exception_ptr,
int responseCode, const
std::string &)> 
OnDone

Public Member Functions

 RestProxy (const std::shared_ptr< zmq::context_t > &context)
void sleepUntilIdle ()
void shutdown ()
void init (std::shared_ptr< ConfigurationService > config, const std::string &serviceName)
void initServiceClass (std::shared_ptr< ConfigurationService > config, const std::string &serviceClass, const std::string &endpointName)
void push (const RestRequest &request, const OnDone &onDone)
void push (const OnDone &onDone, const std::string &method, const std::string &resource, const RestParams &params=RestParams(), const std::string &payload="")
size_t numMessagesOutstanding () const

Protected Member Functions

void handleOperation (const Operation &op)
void handleZmqResponse (const std::vector< std::string > &message)

Protected Attributes

std::string serviceName_
TypedMessageSink< OperationoperationQueue
ZmqNamedProxy connection
std::map< uint64_t, OnDone > outstanding
int numMessagesOutstanding_
uint64_t currentOpId

Detailed Description

Proxy that handles a set of outstanding asynchronous operations to a rest endpoint and deals with getting the results back.

Definition at line 81 of file rest_proxy.h.


Member Function Documentation

void Datacratic::RestProxy::init ( std::shared_ptr< ConfigurationService config,
const std::string &  serviceName 
)

Initialize and connect to the given service on the "zeromq" endpoint.

Reimplemented in RTBKIT::SlaveBudgetController.

Definition at line 74 of file rest_proxy.cc.

void Datacratic::RestProxy::initServiceClass ( std::shared_ptr< ConfigurationService config,
const std::string &  serviceClass,
const std::string &  endpointName 
)

Initialize and connect to an instance of the given service class.

Definition at line 95 of file rest_proxy.cc.

void Datacratic::RestProxy::push ( const RestRequest request,
const OnDone &  onDone 
)

Push the given request to be performed. When the result comes back, it will be passed to OnDone.

Definition at line 115 of file rest_proxy.cc.

void Datacratic::RestProxy::push ( const OnDone &  onDone,
const std::string &  method,
const std::string &  resource,
const RestParams params = RestParams(),
const std::string &  payload = "" 
)

Push the given request to be performed.

Definition at line 128 of file rest_proxy.cc.


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