~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/applier.h

  • Committer: Jay Pipes
  • Date: 2009-02-04 15:44:25 UTC
  • mfrom: (829 drizzle)
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090204154425-th8xfk2ujz2y8xwg
Merge with trunk

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_APPLIER_H
25
 
#define DRIZZLED_PLUGIN_APPLIER_H
26
 
 
27
 
/**
28
 
 * @file Defines the API for an Applier
29
 
 *
30
 
 * An Applier applies an event it has received from a Replicator (via 
31
 
 * a replicator's replicate() call, or it has read using a Reader's read()
32
 
 * call.
33
 
 */
34
 
 
35
 
/* some forward declarations needed */
36
 
namespace drizzled
37
 
{
38
 
  namespace message
39
 
  {
40
 
    class Command;
41
 
  }
42
 
}
43
 
 
44
 
namespace drizzled
45
 
{
46
 
namespace plugin
47
 
{
48
 
 
49
 
/**
50
 
 * Base class for appliers of Command messages
51
 
 */
52
 
class Applier
53
 
{
54
 
public:
55
 
  Applier() {}
56
 
  virtual ~Applier() {}
57
 
  /**
58
 
   * Apply something to a target.
59
 
   *
60
 
   * @note
61
 
   *
62
 
   * It is important to note that memory allocation for the 
63
 
   * supplied pointer is not guaranteed after the completion 
64
 
   * of this function -- meaning the caller can dispose of the
65
 
   * supplied message.  Therefore, appliers which are
66
 
   * implementing an asynchronous replication system must copy
67
 
   * the supplied message to their own controlled memory storage
68
 
   * area.
69
 
   *
70
 
   * @param Command message to be replicated
71
 
   */
72
 
  virtual void apply(drizzled::message::Command *to_apply)= 0;
73
 
  /** 
74
 
   * An applier plugin should override this with its
75
 
   * internal method for determining if it is active or not.
76
 
   */
77
 
  virtual bool isActive() {return false;}
78
 
};
79
 
 
80
 
} /* end namespace drizzled::plugin */
81
 
} /* end namespace drizzled */
82
 
 
83
 
#endif /* DRIZZLED_PLUGIN_APPLIER_H */