~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/scheduler.h

  • Committer: Muhammad Umair
  • Date: 2011-08-16 11:47:29 UTC
  • mto: This revision was merged to the branch mainline in revision 2402.
  • Revision ID: umair@remotedesk-20110816114729-w6x88fj0sow4g3z9
mergeĀ lp:~mumair/drizzle/drizzle-IPv6Address

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
20
 */
21
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
 
{
 
22
#pragma once
 
23
 
 
24
#include <drizzled/plugin/plugin.h>
 
25
#include <drizzled/session.h>
 
26
#include <drizzled/visibility.h>
 
27
 
 
28
namespace drizzled {
 
29
namespace plugin {
38
30
 
39
31
/**
40
32
 * This class should be used by scheduler plugins to implement custom session
41
33
 * schedulers.
42
34
 */
43
 
class Scheduler : public Plugin
 
35
class DRIZZLED_API Scheduler : public Plugin
44
36
{
45
37
  /* Disable default constructors */
46
38
  Scheduler();
50
42
  explicit Scheduler(std::string name_arg)
51
43
    : Plugin(name_arg, "Scheduler")
52
44
  {}
53
 
  virtual ~Scheduler() {}
54
45
 
55
46
  /**
56
47
   * Add a session to the scheduler. When the scheduler is ready to run the
57
48
   * session, it should call session->run().
58
49
   */
59
 
  virtual bool addSession(Session::shared_ptr &session)= 0;
 
50
  virtual bool addSession(const Session::shared_ptr&)= 0;
60
51
 
61
52
  /**
62
53
   * Notify the scheduler that it should be killed gracefully.
63
54
   */
64
 
  virtual void killSession(Session *) {}
 
55
  virtual void killSession(Session*) {}
65
56
 
66
57
  /**
67
58
   * This is called when a scheduler should kill the session immedaitely.
68
59
   */
69
 
  virtual void killSessionNow(Session::shared_ptr&) {}
 
60
  virtual void killSessionNow(const Session::shared_ptr&) {}
70
61
 
71
 
  static bool addPlugin(plugin::Scheduler *sced);
72
 
  static void removePlugin(plugin::Scheduler *sced);
 
62
  static bool addPlugin(plugin::Scheduler*);
 
63
  static void removePlugin(plugin::Scheduler*);
73
64
  static bool setPlugin(const std::string& name);
74
 
  static Scheduler *getScheduler();
 
65
  static Scheduler* getScheduler();
75
66
};
76
67
 
77
68
} /* namespace plugin */
78
69
} /* namespace drizzled */
79
70
 
80
 
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */