~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
1932.3.13 by Brian Aker
Cleanup session ownership rules such that we know exactly when session has
25
#include "drizzled/session.h"
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
26
#include "drizzled/plugin/plugin.h"
27
994.2.2 by Monty Taylor
Store a Registry of SchedulerFactories and set one of them at startup for better error messages earlier.
28
#include <string>
29
#include <vector>
30
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
31
namespace drizzled
32
{
1932.3.3 by Brian Aker
Pull in code to abstract out the session list a bit.
33
1241.9.26 by Monty Taylor
Removed forward declares from server_includes.h
34
class Session;
35
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.
36
namespace plugin
37
{
38
39
/**
40
 * This class should be used by scheduler plugins to implement custom session
41
 * schedulers.
42
 */
1130.2.15 by Monty Taylor
Merged up with trunk.
43
class Scheduler : public Plugin
520.3.2 by mark
add parser and scheduling plugin files
44
{
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
45
  /* Disable default constructors */
46
  Scheduler();
1130.2.15 by Monty Taylor
Merged up with trunk.
47
  Scheduler(const Scheduler &);
48
  Scheduler& operator=(const Scheduler &);
960.1.1 by Monty Taylor
First pass at scheduler plugin.
49
public:
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
50
  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. :)
51
    : Plugin(name_arg, "Scheduler")
1130.2.15 by Monty Taylor
Merged up with trunk.
52
  {}
960.1.1 by Monty Taylor
First pass at scheduler plugin.
53
  virtual ~Scheduler() {}
54
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.
55
  /**
56
   * Add a session to the scheduler. When the scheduler is ready to run the
57
   * session, it should call session->run().
58
   */
1932.3.13 by Brian Aker
Cleanup session ownership rules such that we know exactly when session has
59
  virtual bool addSession(Session::shared_ptr &session)= 0;
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.
60
61
  /**
62
   * Notify the scheduler that it should be killed gracefully.
63
   */
64
  virtual void killSession(Session *) {}
65
66
  /**
67
   * This is called when a scheduler should kill the session immedaitely.
68
   */
1932.3.13 by Brian Aker
Cleanup session ownership rules such that we know exactly when session has
69
  virtual void killSessionNow(Session::shared_ptr&) {}
1152.1.5 by Brian Aker
Remove Factory/make scheduler work like everything else.
70
71
  static bool addPlugin(plugin::Scheduler *sced);
72
  static void removePlugin(plugin::Scheduler *sced);
73
  static bool setPlugin(const std::string& name);
74
  static Scheduler *getScheduler();
971.1.46 by Monty Taylor
Made plugin registration go through Plugin_registry.
75
};
76
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
77
} /* namespace plugin */
78
} /* 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.
79
80
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */