RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
soa/logger/flume_types.h
00001 
00006 #ifndef flume_TYPES_H
00007 #define flume_TYPES_H
00008 
00009 #include <Thrift.h>
00010 #include <TApplicationException.h>
00011 #include <protocol/TProtocol.h>
00012 #include <transport/TTransport.h>
00013 
00014 
00015 
00016 
00017 
00018 struct Priority {
00019   enum type {
00020     FATAL = 0,
00021     ERROR = 1,
00022     WARN = 2,
00023     INFO = 3,
00024     DEBUG = 4,
00025     TRACE = 5
00026   };
00027 };
00028 
00029 extern const std::map<int, const char*> _Priority_VALUES_TO_NAMES;
00030 
00031 struct EventStatus {
00032   enum type {
00033     ACK = 0,
00034     COMMITED = 1,
00035     ERR = 2
00036   };
00037 };
00038 
00039 extern const std::map<int, const char*> _EventStatus_VALUES_TO_NAMES;
00040 
00041 typedef int64_t Timestamp;
00042 
00043 typedef struct _ThriftFlumeEvent__isset {
00044   _ThriftFlumeEvent__isset() : timestamp(false), priority(false), body(false), nanos(false), host(false), fields(false) {}
00045   bool timestamp;
00046   bool priority;
00047   bool body;
00048   bool nanos;
00049   bool host;
00050   bool fields;
00051 } _ThriftFlumeEvent__isset;
00052 
00053 class ThriftFlumeEvent {
00054  public:
00055 
00056   static const char* ascii_fingerprint; // = "BC13FFB3246A0179557F7F60C181A557";
00057   static const uint8_t binary_fingerprint[16]; // = {0xBC,0x13,0xFF,0xB3,0x24,0x6A,0x01,0x79,0x55,0x7F,0x7F,0x60,0xC1,0x81,0xA5,0x57};
00058 
00059   ThriftFlumeEvent() : timestamp(0), body(""), nanos(0), host("") {
00060   }
00061 
00062   virtual ~ThriftFlumeEvent() throw() {}
00063 
00064   Timestamp timestamp;
00065   Priority::type priority;
00066   std::string body;
00067   int64_t nanos;
00068   std::string host;
00069   std::map<std::string, std::string>  fields;
00070 
00071   _ThriftFlumeEvent__isset __isset;
00072 
00073   bool operator == (const ThriftFlumeEvent & rhs) const
00074   {
00075     if (!(timestamp == rhs.timestamp))
00076       return false;
00077     if (!(priority == rhs.priority))
00078       return false;
00079     if (!(body == rhs.body))
00080       return false;
00081     if (!(nanos == rhs.nanos))
00082       return false;
00083     if (!(host == rhs.host))
00084       return false;
00085     if (!(fields == rhs.fields))
00086       return false;
00087     return true;
00088   }
00089   bool operator != (const ThriftFlumeEvent &rhs) const {
00090     return !(*this == rhs);
00091   }
00092 
00093   bool operator < (const ThriftFlumeEvent & ) const;
00094 
00095   uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
00096   uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
00097 
00098 };
00099 
00100 
00101 
00102 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator