~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/scheduler.h

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

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
 
#include "drizzled/visibility.h"
32
 
 
33
 
namespace drizzled
34
 
{
35
 
 
36
 
class Session;
37
 
 
38
 
namespace plugin
39
 
{
 
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 {
40
30
 
41
31
/**
42
32
 * This class should be used by scheduler plugins to implement custom session
52
42
  explicit Scheduler(std::string name_arg)
53
43
    : Plugin(name_arg, "Scheduler")
54
44
  {}
55
 
  virtual ~Scheduler() {}
56
45
 
57
46
  /**
58
47
   * Add a session to the scheduler. When the scheduler is ready to run the
59
48
   * session, it should call session->run().
60
49
   */
61
 
  virtual bool addSession(Session::shared_ptr &session)= 0;
 
50
  virtual bool addSession(const Session::shared_ptr&)= 0;
62
51
 
63
52
  /**
64
53
   * Notify the scheduler that it should be killed gracefully.
65
54
   */
66
 
  virtual void killSession(Session *) {}
 
55
  virtual void killSession(Session*) {}
67
56
 
68
57
  /**
69
58
   * This is called when a scheduler should kill the session immedaitely.
70
59
   */
71
 
  virtual void killSessionNow(Session::shared_ptr&) {}
 
60
  virtual void killSessionNow(const Session::shared_ptr&) {}
72
61
 
73
 
  static bool addPlugin(plugin::Scheduler *sced);
74
 
  static void removePlugin(plugin::Scheduler *sced);
 
62
  static bool addPlugin(plugin::Scheduler*);
 
63
  static void removePlugin(plugin::Scheduler*);
75
64
  static bool setPlugin(const std::string& name);
76
 
  static Scheduler *getScheduler();
 
65
  static Scheduler* getScheduler();
77
66
};
78
67
 
79
68
} /* namespace plugin */
80
69
} /* namespace drizzled */
81
70
 
82
 
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */