// -*- IDL -*-

//=============================================================================
/**
 *  @file    FTRT_GroupManager.idl
 *
 *  $Id: FTRT_GroupManager.idl 60498 2004-09-17 20:53:10Z wilson_d $
 *
 *  @author Huang-Ming Huang
 */
//=============================================================================

#ifndef TAO_FTRT_GROUPMANAGER_IDL
#define TAO_FTRT_GROUPMANAGER_IDL

#include "orbsvcs/RtecEventChannelAdmin.idl"
#include "orb.idl"
#include "orbsvcs/CosNaming.idl"
#include "FTRT.idl"

module FTRT
{
  typedef CosNaming::Name Location;

  interface FaultListener {
    /// called by the replica which detect the loss of connection with its
    /// predecessor to the primary
    oneway void replica_crashed(in Location the_location);
  };

  interface ObjectGroupManager;

  struct ManagerInfo {
    Location the_location;
    ObjectGroupManager ior;
  };

  exception PredecessorUnreachable {};

  typedef sequence<ManagerInfo> ManagerInfoList;
  exception InvalidState{};

  interface ObjectGroupManager : FaultListener {
    boolean start(in FaultListener listener,
      out Location the_location);

    void create_group(in ManagerInfoList info_list,
      in unsigned long object_group_ref_version)
      raises(PredecessorUnreachable);

    /// called by a newly created replica to the primary
    //  for requesting for joining a object group
    oneway void join_group(in ManagerInfo info);

    /// called by primary to replicas
    /// for adding a new member to the group
    void add_member(in ManagerInfo info,
      in unsigned long object_group_ref_version);

    /// called by the primary to backups for deleting a member from
    /// the group
    oneway void remove_member(in Location crashed_location,
      in unsigned long object_group_ref_version);

    void set_state(in State stat)
      raises (InvalidState);

  };
};

#endif
