summaryrefslogtreecommitdiff
path: root/src/loadbalance.hh
blob: 8f57b92cf1f63a37da13ed4284f36f89a1231d91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Module: loadbalance.hh
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 */
#ifndef __LOADBALANCE_HH__
#define __LOADBALANCE_HH__

#include <time.h>

#include <string>
#include <map>

#include "lbdatafactory.hh"
#include "lbpathtest.hh"
#include "lbdecision.hh"
#include "lboutput.hh"
#include "lbdata.hh"


using namespace std;

class LoadBalance
{
 public:
  LoadBalance(bool debug, string &output_path);
  ~LoadBalance();

  bool set_conf(const string &filename);

  void init();

  bool start_cycle();

  void health_test();

  void apply_rules();

  void output();

  //temporary stand-in for now...
  void sleep() {::sleep(5);}

 private:
  bool _debug;
  LBDataFactory _lbdata_factory;
  LBData _lbdata;
  LBPathTest _ph;
  LBDecision _decision;
  LBOutput _output;
  int _cycle_interval;
};

#endif //__LOADBALANCE_HH__