~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/applier.h

  • Committer: Brian Aker
  • Date: 2009-08-17 06:21:44 UTC
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: brian@gaz-20090817062144-8lxn1sg93pd8nhev
Remove PACK_KEYS

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
 
 *  Copyright (c) 2010 Jay Pipes
6
5
 *
7
6
 *  Authors:
8
7
 *
9
 
 *    Jay Pipes <jaypipes@gmail.com>
 
8
 *    Jay Pipes <joinfu@sun.com>
10
9
 *
11
10
 *  This program is free software; you can redistribute it and/or modify
12
11
 *  it under the terms of the GNU General Public License as published by
22
21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23
22
 */
24
23
 
25
 
#ifndef DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
26
 
#define DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
 
24
#ifndef DRIZZLED_PLUGIN_APPLIER_H
 
25
#define DRIZZLED_PLUGIN_APPLIER_H
27
26
 
28
27
/**
29
 
 * @file Defines the API for a TransactionApplier
 
28
 * @file Defines the API for an Applier
30
29
 *
31
 
 * A TransactionApplier applies an event it has received from a TransactionReplicator (via 
32
 
 * a replicator's replicate() call, or it has read using a TransactionReader's read()
 
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()
33
32
 * call.
34
33
 */
35
34
 
36
 
#include "drizzled/plugin/plugin.h"
37
 
#include "drizzled/plugin/replication.h"
38
 
 
39
 
namespace drizzled
40
 
{
41
 
 
42
 
class Session;
43
 
 
44
 
namespace message { class Transaction; }
45
 
 
 
35
/* some forward declarations needed */
 
36
namespace drizzled
 
37
{
 
38
  namespace message
 
39
  {
 
40
    class Command;
 
41
  }
 
42
}
 
43
 
 
44
namespace drizzled
 
45
{
46
46
namespace plugin
47
47
{
48
48
 
49
49
/**
50
 
 * Base class for appliers of Transaction messages
 
50
 * Base class for appliers of Command messages
51
51
 */
52
 
class TransactionApplier : public Plugin
 
52
class Applier
53
53
{
54
 
  TransactionApplier();
55
 
  TransactionApplier(const TransactionApplier &);
56
 
  TransactionApplier& operator=(const TransactionApplier &);
57
54
public:
58
 
  explicit TransactionApplier(std::string name_arg)
59
 
    : Plugin(name_arg, "TransactionApplier")
60
 
  {
61
 
  }
62
 
  virtual ~TransactionApplier() {}
 
55
  Applier() {}
 
56
  virtual ~Applier() {}
63
57
  /**
64
58
   * Apply something to a target.
65
59
   *
73
67
   * the supplied message to their own controlled memory storage
74
68
   * area.
75
69
   *
76
 
   * @param Transaction message to be replicated
77
 
   */
78
 
  virtual ReplicationReturnCode apply(Session &in_session,
79
 
                                      const message::Transaction &to_apply)= 0;
80
 
 
81
 
  static bool addPlugin(TransactionApplier *applier);
82
 
  static void removePlugin(TransactionApplier *applier);
 
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;}
83
78
};
84
79
 
85
 
} /* namespace plugin */
86
 
} /* namespace drizzled */
 
80
} /* end namespace drizzled::plugin */
 
81
} /* end namespace drizzled */
87
82
 
88
 
#endif /* DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H */
 
83
#endif /* DRIZZLED_PLUGIN_APPLIER_H */