~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/scheduler.h

  • Committer: Monty Taylor
  • Date: 2008-10-09 22:38:27 UTC
  • mto: This revision was merged to the branch mainline in revision 497.
  • Revision ID: monty@inaugust.com-20081009223827-bc9gvpiplsmvpwyq
Moved test() to its own file.
Made a new function to possibly replace int10_to_str.

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
 
 *  Definitions required for Configuration Variables plugin
5
 
 *
6
 
 *  Copyright (C) 2008 Sun Microsystems
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
 
 
22
 
#ifndef DRIZZLED_PLUGIN_SCHEDULER_H
23
 
#define DRIZZLED_PLUGIN_SCHEDULER_H
24
 
 
25
 
#include "drizzled/session.h"
26
 
#include "drizzled/plugin/plugin.h"
27
 
 
28
 
#include <string>
29
 
#include <vector>
30
 
 
31
 
namespace drizzled
32
 
{
33
 
 
34
 
class Session;
35
 
 
36
 
namespace plugin
37
 
{
38
 
 
39
 
/**
40
 
 * This class should be used by scheduler plugins to implement custom session
41
 
 * schedulers.
42
 
 */
43
 
class Scheduler : public Plugin
44
 
{
45
 
  /* Disable default constructors */
46
 
  Scheduler();
47
 
  Scheduler(const Scheduler &);
48
 
  Scheduler& operator=(const Scheduler &);
49
 
public:
50
 
  explicit Scheduler(std::string name_arg)
51
 
    : Plugin(name_arg, "Scheduler")
52
 
  {}
53
 
  virtual ~Scheduler() {}
54
 
 
55
 
  /**
56
 
   * Add a session to the scheduler. When the scheduler is ready to run the
57
 
   * session, it should call session->run().
58
 
   */
59
 
  virtual bool addSession(Session::shared_ptr &session)= 0;
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
 
   */
69
 
  virtual void killSessionNow(Session::shared_ptr&) {}
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();
75
 
};
76
 
 
77
 
} /* namespace plugin */
78
 
} /* namespace drizzled */
79
 
 
80
 
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */