1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Definitions required for Configuration Variables plugin
6
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
22
#ifndef DRIZZLED_PLUGIN_SCHEDULER_H
23
#define DRIZZLED_PLUGIN_SCHEDULER_H
25
#include "drizzled/plugin/plugin.h"
38
* This class should be used by scheduler plugins to implement custom session
41
class Scheduler : public Plugin
43
/* Disable default constructors */
45
Scheduler(const Scheduler &);
46
Scheduler& operator=(const Scheduler &);
48
explicit Scheduler(std::string name_arg)
49
: Plugin(name_arg, "Scheduler")
51
virtual ~Scheduler() {}
54
* Add a session to the scheduler. When the scheduler is ready to run the
55
* session, it should call session->run().
57
virtual bool addSession(Session *session)= 0;
60
* Notify the scheduler that it should be killed gracefully.
62
virtual void killSession(Session *) {}
65
* This is called when a scheduler should kill the session immedaitely.
67
virtual void killSessionNow(Session *) {}
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();
75
} /* namespace plugin */
76
} /* namespace drizzled */
78
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */