~drizzle-trunk/drizzle/development

988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
 *
6
 *  Authors:
7
 *
8
 *    Jay Pipes <joinfu@sun.com>
9
 *
10
 *  This program is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; version 2 of the License.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program; if not, write to the Free Software
21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
 */
636.1.1 by Mark Atwood
add replicator plugin type
23
24
#ifndef DRIZZLED_PLUGIN_REPLICATOR_H
25
#define DRIZZLED_PLUGIN_REPLICATOR_H
26
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
27
/**
988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
28
 * @file Defines the API for a Replicator.  
29
 *
30
 * All a replicator does is replicate/reproduce
31
 * events, optionally transforming them before sending them off to an applier.
32
 *
33
 * An applier is responsible for applying events, not a replicator...
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
34
 */
35
988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
36
/* some forward declarations needed */
37
namespace drizzled
38
{
39
  namespace message
40
  {
41
    class Command;
42
  }
43
  class Applier;
44
}
45
46
namespace drizzled
47
{
48
namespace plugin
49
{
50
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
51
/**
988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
52
 * Class which replicates Command messages
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
53
 */
54
class Replicator
636.1.1 by Mark Atwood
add replicator plugin type
55
{
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
56
public:
988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
57
  Replicator() {}
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
58
  virtual ~Replicator() {}
59
  /**
988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
60
   * Replicate a Command message to an Applier.
61
   *
62
   * @note
63
   *
64
   * It is important to note that memory allocation for the 
65
   * supplied pointer is not guaranteed after the completion 
66
   * of this function -- meaning the caller can dispose of the
67
   * supplied message.  Therefore, replicators and appliers 
68
   * implementing an asynchronous replication system must copy
69
   * the supplied message to their own controlled memory storage
70
   * area.
71
   *
72
   * @param Command message to be replicated
73
   */
74
  virtual void replicate(Applier *in_applier, drizzled::message::Command *to_replicate)= 0;
75
  /** 
76
   * A replicator plugin should override this with its
77
   * internal method for determining if it is active or not.
78
   */
79
  virtual bool isActive() {return false;}
960.4.1 by Monty Taylor
Changed replicator plugins to class based.
80
};
636.1.1 by Mark Atwood
add replicator plugin type
81
988.1.5 by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator
82
} /* end namespace drizzled::plugin */
83
} /* end namespace drizzled */
84
636.1.1 by Mark Atwood
add replicator plugin type
85
#endif /* DRIZZLED_PLUGIN_REPLICATOR_H */