RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <compressing_output.h>
Classes | |
struct | Message |
Public Member Functions | |
WorkerThreadOutput (size_t ringBufferSize=65536) | |
virtual void | logMessage (const std::string &channel, const std::string &message) |
virtual Json::Value | stats () const |
virtual void | clearStats () |
Protected Types | |
enum | MessageType { MT_LOG, MT_END, MT_OP, MT_SHUTDOWN } |
Protected Member Functions | |
void | startWorkerThread () |
void | stopWorkerThread () |
void | pushOperation (const std::function< void()> &op) |
virtual void | implementLogMessage (const std::string &channel, const std::string &message)=0 |
void | runLogThread () |
Thread to run the logging. | |
Protected Attributes | |
ML::RingBufferSRMW< Message > | ringBuffer |
boost::scoped_ptr< boost::thread > | logThread |
Thread to do the logging. | |
ML::Duty_Cycle_Timer | duty |
Get information on duty cycle. | |
volatile int | shutdown_ |
volatile int | up_ |
LogOutput implementation that causes work to be done in a separate thread. Supports both writing of records and rotation in a strictly ordered manner.
Definition at line 35 of file compressing_output.h.
enum Datacratic::WorkerThreadOutput::MessageType [protected] |
MT_LOG |
Log the given thing. |
MT_END |
End the record. |
MT_OP |
Run the given function in the thread. |
Definition at line 57 of file compressing_output.h.
void Datacratic::WorkerThreadOutput::clearStats | ( | ) | [virtual] |
Clears the current value of stats. Default implementation does nothing.
Reimplemented from Datacratic::LogOutput.
Definition at line 123 of file compressing_output.cc.
void Datacratic::WorkerThreadOutput::logMessage | ( | const std::string & | channel, |
const std::string & | message | ||
) | [virtual] |
This is the method that will be called whenever we need to log a message to something.
Implements Datacratic::LogOutput.
Definition at line 71 of file compressing_output.cc.
void Datacratic::WorkerThreadOutput::pushOperation | ( | const std::function< void()> & | op | ) | [protected] |
Push the given operation onto a queue of things to be done. It will be done in the worker thread once its time is up.
Definition at line 96 of file compressing_output.cc.
Json::Value Datacratic::WorkerThreadOutput::stats | ( | ) | const [virtual] |
Should return a JSON object containing whatever stats have been accumulated since last time clearStats() was called.
Default returns an empty JSON object.
Reimplemented from Datacratic::LogOutput.
Definition at line 107 of file compressing_output.cc.