~drizzle-trunk/drizzle/development

1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
520.3.2 by mark
add parser and scheduling plugin files
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
3
 *
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
4
 *  Definitions required for Configuration Variables plugin
1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
5
 *
1010 by Brian Aker
Replacing Sun employee copyright headers (aka... anything done by a Sun
6
 *  Copyright (C) 2008 Sun Microsystems
520.3.2 by mark
add parser and scheduling plugin files
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; version 2 of the License.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 */
21
971.3.64 by Eric Day
Cleaned up Scheduler plugin, moved more code to the schedular plugins, reworked some functions to be methods in Session, removed some dead code.
22
#ifndef DRIZZLED_PLUGIN_SCHEDULER_H
23
#define DRIZZLED_PLUGIN_SCHEDULER_H
520.3.2 by mark
add parser and scheduling plugin files
24
1237.9.3 by Padraig O'Sullivan
Removed one the includes I put in server_includes.h for the last commit to get rid of the inclusion
25
#include "drizzled/plugin/plugin.h"
26
994.2.2 by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier.
27
#include <string>
28
#include <vector>
29
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
30
namespace drizzled
31
{
1241.9.26 by Monty Taylor
Removed forward declares from server_includes.h
32
class Session;
33
971.3.64 by Eric Day
Cleaned up Scheduler plugin, moved more code to the schedular plugins, reworked some functions to be methods in Session, removed some dead code.
34
namespace plugin
35
{
36
37
/**
38
 * This class should be used by scheduler plugins to implement custom session
39
 * schedulers.
40
 */
1130.2.15 by Monty Taylor
Merged up with trunk.
41
class Scheduler : public Plugin
520.3.2 by mark
add parser and scheduling plugin files
42
{
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
43
  /* Disable default constructors */
44
  Scheduler();
1130.2.15 by Monty Taylor
Merged up with trunk.
45
  Scheduler(const Scheduler &);
46
  Scheduler& operator=(const Scheduler &);
960.1.1 by Monty Taylor
First pass at scheduler plugin.
47
public:
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
48
  explicit Scheduler(std::string name_arg)
1192.2.5 by Monty Taylor
Replaced overridable virtual methods with passing name to constructor. Now individual plugins will not be allowed to set their own plugin type name. :)
49
    : Plugin(name_arg, "Scheduler")
1130.2.15 by Monty Taylor
Merged up with trunk.
50
  {}
960.1.1 by Monty Taylor
First pass at scheduler plugin.
51
  virtual ~Scheduler() {}
52
971.3.64 by Eric Day
Cleaned up Scheduler plugin, moved more code to the schedular plugins, reworked some functions to be methods in Session, removed some dead code.
53
  /**
54
   * Add a session to the scheduler. When the scheduler is ready to run the
55
   * session, it should call session->run().
56
   */
57
  virtual bool addSession(Session *session)= 0;
58
59
  /**
60
   * Notify the scheduler that it should be killed gracefully.
61
   */
62
  virtual void killSession(Session *) {}
63
64
  /**
65
   * This is called when a scheduler should kill the session immedaitely.
66
   */
67
  virtual void killSessionNow(Session *) {}
1152.1.5 by Brian Aker
Remove Factory/make scheduler work like everything else.
68
69
  static bool addPlugin(plugin::Scheduler *sced);
70
  static void removePlugin(plugin::Scheduler *sced);
71
  static bool setPlugin(const std::string& name);
72
  static Scheduler *getScheduler();
971.1.46 by Monty Taylor
Made plugin registration go through Plugin_registry.
73
};
74
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
75
} /* namespace plugin */
76
} /* namespace drizzled */
971.3.64 by Eric Day
Cleaned up Scheduler plugin, moved more code to the schedular plugins, reworked some functions to be methods in Session, removed some dead code.
77
78
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */