~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/scheduler.h

  • Committer: Brian Aker
  • Date: 2009-10-01 22:56:26 UTC
  • mto: (1154.1.1 staging)
  • mto: This revision was merged to the branch mainline in revision 1155.
  • Revision ID: brian@gaz-20091001225626-sb1pdykpxlnkheaj
Remove Factory/make scheduler work like everything else.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
class Scheduler
39
39
{
40
40
public:
41
 
  Scheduler() {}
 
41
  Scheduler(const char *name_arg) : 
 
42
    name(name_arg) {}
42
43
  virtual ~Scheduler() {}
43
44
 
44
45
  /**
56
57
   * This is called when a scheduler should kill the session immedaitely.
57
58
   */
58
59
  virtual void killSessionNow(Session *) {}
59
 
};
60
 
 
61
 
class SchedulerFactory
62
 
{
63
 
  std::string name;
64
 
  std::vector<std::string> aliases;
65
 
protected:
66
 
  Scheduler *scheduler;
67
 
public:
68
 
  SchedulerFactory(std::string name_arg): name(name_arg), scheduler(NULL) {}
69
 
  SchedulerFactory(const char *name_arg): name(name_arg), scheduler(NULL) {}
70
 
  virtual ~SchedulerFactory() {}
71
 
  virtual Scheduler *operator()(void)= 0;
72
 
  std::string getName() const {return name;}
73
 
  const std::vector<std::string>& getAliases() const {return aliases;}
74
 
  void addAlias(std::string alias)
75
 
  {
76
 
    aliases.push_back(alias);
77
 
  }
78
 
 
79
 
  static bool addPlugin(plugin::SchedulerFactory *factory);
80
 
  static void removePlugin(plugin::SchedulerFactory *factory);
81
 
  static bool setFactory(const std::string& name);
82
 
  static plugin::Scheduler *getScheduler();
83
 
 
 
60
 
 
61
  static bool addPlugin(plugin::Scheduler *sced);
 
62
  static void removePlugin(plugin::Scheduler *sced);
 
63
  static bool setPlugin(const std::string& name);
 
64
  static Scheduler *getScheduler();
 
65
 
 
66
  /* TODO: make this private */
 
67
  const string name;
84
68
};
85
69
 
86
70
} /* end namespace drizzled::plugin */