~drizzle-trunk/drizzle/development

1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
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_READER_H
25
#define DRIZZLED_PLUGIN_COMMAND_READER_H
26
27
#include <drizzled/replication_services.h> /* For global transaction ID typedef */
28
29
/**
30
 * @file Defines the API for a CommandReader
31
 *
32
 * A command reader is a class which is able to read Command messages from some source
33
 */
34
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
35
namespace drizzled
36
{
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
37
/* some forward declarations needed */
1130.2.17 by Monty Taylor
Fixed an extra }
38
namespace message { class Command; }
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
39
40
namespace plugin
41
{
42
43
44
/**
45
 * Class which can read Command messages from some source
46
 */
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
47
class CommandReader : public Plugin
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
48
{
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
49
  CommandReader();
50
  CommandReader(const CommandReader &);
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
51
  CommandReader& operator=(const CommandReader &);
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
52
public:
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
53
  explicit CommandReader(std::string name_arg) : Plugin(name_arg) {}
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
54
  virtual ~CommandReader() {}
55
  /**
56
   * Read and fill a Command message with the supplied
57
   * Command message global transaction ID.
58
   *
59
   * @param Global transaction ID to find
60
   * @param Pointer to a command message to fill
61
   *
62
   * @retval
1039.5.53 by Jay Pipes
Fixes based on Monty's code review.
63
   *  true if Command message was read successfully and the supplied pointer
64
   *  to message was filled
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
65
   * @retval
66
   *  false if not found or read successfully
67
   */
1039.5.53 by Jay Pipes
Fixes based on Monty's code review.
68
  virtual bool read(const ReplicationServices::GlobalTransactionId &to_read, 
69
                    message::Command *to_fill)= 0;
1039.5.41 by Jay Pipes
Adds a new plugin class interface for a reader of Command messages,
70
};
71
72
} /* end namespace drizzled::plugin */
73
} /* end namespace drizzled */
74
75
#endif /* DRIZZLED_PLUGIN_COMMAND_READER_H */