summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Random.h
blob: 76c71a3f5620a37d8ee3f8dd10f04944a2d6a4ec (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file FT_Random.h
 *
 *  @author Kevin Stanley <stanleyk@ociweb.com>
 */
//=============================================================================


#ifndef FT_RANDOM_H
#define FT_RANDOM_H

#include /**/ "ace/pre.h"

#include "ace/Null_Mutex.h"

# if !defined (ACE_LACKS_PRAGMA_ONCE)
#   pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */

#include "orbsvcs/Naming/FaultTolerant/FT_Location_Index_Map.h"


#include "orbsvcs/CosLoadBalancingS.h"
#include "ace/Vector_T.h"
#include "orbsvcs/Naming/FaultTolerant/ftnaming_export.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_FT_Naming_Manager;

/**
 * @class TAO_LB_Random_Strategy
 *
 * @brief "Random" load balancing strategy used by the
 * TAO_FT_Naming_Service.
 *
 * This load balancing strategy is designed to select an object group
 * member residing at the next location from an object group managed
 * by a specific Naming Manager. It selects an object from the object
 * group in the order in which they are stored.
 */
class TAO_FtNaming_Export TAO_FT_Random
{
public:
  /// Constructor.
  TAO_FT_Random () = default;

  /// Destructor
  virtual ~TAO_FT_Random () = default;

  /// This function obtains the next object's location as it is bound
  /// within the object group.
  /// @param naming_manager The TAO_FT_Naming_Manager which houses the
  /// object groups.
  /// @param location The resulting location
  /// @param object_group The object group from which the object is to
  /// be selected
  /// @return False on error. Returns true if a valid object can
  /// be selected using the Random load balancing strategy.
  virtual bool next_location (
      PortableGroup::ObjectGroup_ptr object_group,
      TAO_FT_Naming_Manager *naming_manager,
      PortableGroup::Location& location);
};

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"

#endif  /* FT_RANDOM_H */