summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/LoadBalancer/LoadBalancer.h
blob: 4c0b97a425c6e73a3a5551752682c30e8ba9c993 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//   orbsvcs/LoadBalancer
//
// = FILENAME
//   LoadBalancer.h
//
// = DESCRIPTION
//   Implement the LoadBalancing service as a standalone process.
//
// = AUTHORS
//   Ossama Othman (ossama@uci.edu)
//
// ============================================================================

#ifndef TAO_LOADBALANCER_H
#define TAO_LOADBALANCER_H

#include "orbsvcs/LoadBalancing/LoadBalancer_i.h"
#include "orbsvcs/LoadBalancing/Round_Robin_Strategy.h"
#include "orbsvcs/LoadBalancing/Minimum_Dispersion.h"

class TAO_LoadBalancer
{
  // = TITLE
  //   Defines a class that encapsulates the implementation of the
  //   LoadBalancing Service
  //
  // = DESCRIPTION
public:
  TAO_LoadBalancer (void);
  // Default Constructor.

  ~TAO_LoadBalancer (void);
  // Destructor.

  void init (int argc, char *argv[]
             TAO_ENV_ARG_DECL);
  // Initialize the service

  void run (TAO_ENV_SINGLE_ARG_DECL);
  // Run the TAO_Loadbalancer.

protected:
  void parse_args (int argc, char *argv[]
                   TAO_ENV_ARG_DECL);
  // parses the arguments.

  void usage (const char *msg) const;
  // Print a usage message

private:
  const char * repository_id_;
  // The repository ID for the interface of the object being load
  // balanced.

  // @@ Ossama: the current version just dumps the IOR to a file, we
  // may want to integrate it with the naming service too.
  const char *load_balancer_file_;
  // The load balancing service IOR is stored in this file

  int strategy_;
  // Select the right strategy

  // @@ Ossama: the strategies should be created by a factory, the
  // factory should be a Service Object that can be dynamically
  // loaded.
  // @@ Ossama: here is more food for thought, can we provide a
  // generic load balancing service that can implement static,
  // per-request and dynamic load balancing?  If not, can we share the
  // current strategies among them?
  TAO_LB_Round_Robin_Strategy round_robin_;
  TAO_LB_Minimum_Dispersion_Strategy minimum_dispersion_;

  TAO_LB_LoadBalancer *balancer_;
  // The load balancer

  CORBA::ORB_var orb_;
  // The ORB

  PortableServer::POA_var root_poa_;
  // The root POA
};

#endif /* TAO_LOADBALANCER_H */