~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/binary_log.h

  • Committer: Brian Aker
  • Date: 2009-08-17 01:44:23 UTC
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: brian@gaz-20090817014423-jxi2qonsumm8mndf
Remove SQL level reference for DELAY (just now done correctly by default in
engine).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++ -*-
 
2
 
 
3
#ifndef BINARY_LOG_H_INCLUDED
 
4
#define BINARY_LOG_H_INCLUDED
 
5
 
 
6
#include <drizzled/message/binary_log.pb.h>
 
7
#include "binlog_encoding.h"
 
8
 
 
9
#include <google/protobuf/io/zero_copy_stream.h>
 
10
 
 
11
#include <iosfwd>
 
12
#include <stdexcept>
 
13
 
 
14
namespace BinaryLog {
 
15
 
 
16
  /**
 
17
     Wrapper class to wrap a protobuf event in a type tag and a length.
 
18
 
 
19
     The type tag is not part of the actual message, but is handled
 
20
     separately since it is needed to decode the events.
 
21
  */
 
22
  class Event {
 
23
  public:
 
24
    enum EventType {
 
25
      UNDEF,
 
26
      START,
 
27
      CHAIN,
 
28
      COMMIT,
 
29
      ROLLBACK,
 
30
      QUERY,
 
31
      COUNT
 
32
    };
 
33
 
 
34
    Event(EventType type, google::protobuf::Message *message)
 
35
      : m_type(type), m_message(message)
 
36
    {
 
37
    }
 
38
 
 
39
    Event()
 
40
      : m_type(UNDEF), m_message(0)
 
41
    {
 
42
    }
 
43
 
 
44
    ~Event() {
 
45
      delete m_message;
 
46
    }
 
47
 
 
48
    bool write(google::protobuf::io::CodedOutputStream* out) const;
 
49
    void print(std::ostream& out) const;
 
50
    bool read(google::protobuf::io::CodedInputStream* in);
 
51
 
 
52
  private:
 
53
    EventType m_type;
 
54
    google::protobuf::Message *m_message;
 
55
  };
 
56
}
 
57
 
 
58
#endif /* BINARY_LOG_H_INCLUDED */