~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/serialize/binary_log.h

Merge Revision revid:marko.makela@oracle.com-20100505101406-u4low2x26q6itck0 from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100505101406-u4low2x26q6itck0

Original Authors: Marko Mäkelä <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

  ------------------------------------------------------------
  revno: 3446
  revision-id: marko.makela@oracle.com-20100505100507-6kcd2hf32hruxbv7
  parent: marko.makela@oracle.com-20100505095328-vetnl0flhmhao7p5
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Wed 2010-05-05 13:05:07 +0300
  message:
    Add Valgrind diagnostics to track down Bug #38999.
  ------------------------------------------------------------

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 "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
 
  using namespace google::protobuf;
16
 
  using namespace google::protobuf::io;
17
 
 
18
 
  /**
19
 
     Wrapper class to wrap a protobuf event in a type tag and a length.
20
 
 
21
 
     The type tag is not part of the actual message, but is handled
22
 
     separately since it is needed to decode the events.
23
 
  */
24
 
  class Event {
25
 
  public:
26
 
    enum EventType {
27
 
      UNDEF,
28
 
      START,
29
 
      CHAIN,
30
 
      COMMIT,
31
 
      ROLLBACK,
32
 
      QUERY,
33
 
      COUNT
34
 
    };
35
 
 
36
 
    Event(EventType type, Message *message)
37
 
      : m_type(type), m_message(message)
38
 
    {
39
 
    }
40
 
 
41
 
    Event()
42
 
      : m_type(UNDEF), m_message(0)
43
 
    {
44
 
    }
45
 
 
46
 
    ~Event() {
47
 
      delete m_message;
48
 
    }
49
 
 
50
 
    bool write(CodedOutputStream* out) const;
51
 
    void print(std::ostream& out) const;
52
 
    bool read(CodedInputStream* in);
53
 
 
54
 
  private:
55
 
    EventType m_type;
56
 
    Message *m_message;
57
 
  };
58
 
}
59
 
 
60
 
#endif /* BINARY_LOG_H_INCLUDED */