~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/command_replicator.h

  • Committer: Monty Taylor
  • Date: 2009-09-23 17:40:57 UTC
  • mfrom: (1099.4.60)
  • mto: This revision was merged to the branch mainline in revision 1141.
  • Revision ID: mordred@inaugust.com-20090923174057-wuvqhk19h43no9wz
Merged translations from launchpad.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
23
 
 
24
#ifndef DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H
 
25
#define DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H
 
26
 
 
27
/**
 
28
 * @file Defines the API for a CommandReplicator.  
 
29
 *
 
30
 * All a replicator does is replicate/reproduce
 
31
 * events, optionally transforming them before sending them off to a CommandApplier.
 
32
 *
 
33
 * An applier is responsible for applying events, not a replicator...
 
34
 */
 
35
 
 
36
/* some forward declarations needed */
 
37
namespace drizzled
 
38
{
 
39
  namespace message
 
40
  {
 
41
    class Command;
 
42
  }
 
43
}
 
44
 
 
45
namespace drizzled
 
46
{
 
47
namespace plugin
 
48
{
 
49
 
 
50
class CommandApplier;
 
51
 
 
52
/**
 
53
 * Class which replicates Command messages
 
54
 */
 
55
class CommandReplicator
 
56
{
 
57
public:
 
58
  CommandReplicator() {}
 
59
  virtual ~CommandReplicator() {}
 
60
  /**
 
61
   * Replicate a Command message to a CommandApplier.
 
62
   *
 
63
   * @note
 
64
   *
 
65
   * It is important to note that memory allocation for the 
 
66
   * supplied pointer is not guaranteed after the completion 
 
67
   * of this function -- meaning the caller can dispose of the
 
68
   * supplied message.  Therefore, replicators and appliers 
 
69
   * implementing an asynchronous replication system must copy
 
70
   * the supplied message to their own controlled memory storage
 
71
   * area.
 
72
   *
 
73
   * @param Pointer to the applier of the command message
 
74
   * @param Command message to be replicated
 
75
   */
 
76
  virtual void replicate(CommandApplier *in_applier, 
 
77
                         message::Command &to_replicate)= 0;
 
78
  /** 
 
79
   * A replicator plugin should override this with its
 
80
   * internal method for determining if it is active or not.
 
81
   */
 
82
  virtual bool isActive() {return false;}
 
83
};
 
84
 
 
85
} /* end namespace drizzled::plugin */
 
86
} /* end namespace drizzled */
 
87
 
 
88
#endif /* DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H */