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

#include <compressing_output.h>

Inheritance diagram for Datacratic::WorkerThreadOutput:
Datacratic::LogOutput Datacratic::CompressingOutput Datacratic::NamedOutput Datacratic::CloudOutput Datacratic::FileOutput

List of all members.

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< MessageringBuffer
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_

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
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.


Member Function Documentation

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.

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.


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