// -*- IDL -*-
// $Id: ImR_Locator.idl 97526 2014-01-10 22:25:40Z mesnier_p $

#include "ImR_Activator.idl"

module ImplementationRepository
{
  interface Locator : AdministrationExt
  {
    /// returns a token that can be used (along with activator name) to
    /// unregister the activator.
    long register_activator (in string name, in Activator act);

    /// You must pass in the token returned from register_activator.
    void unregister_activator (in string name, in long token);

    /// The ImR_Activator calls this method to notify death of child
    /// process that it had started.
    void notify_child_death (in string name);

    /// Newer Activators call this method to notify death of child
    /// process including pid to disambiguate child instances
    void child_death_pid (in string name, in long pid);

    /// Newer Activators call this method to notify spawn of child
    /// process to supply pid for reference
    void spawn_pid (in string name, in long pid);


  };

  enum UpdateType
  {
    repo_add,
    repo_update,
    repo_remove
  };

  typedef long SequenceNum;

  struct ServerUpdate
  {
    string      name;
    string      server_id;
    UpdateType  type;
    long        repo_id;
    long        repo_type;
    SequenceNum seq_num;
  };

  struct ActivatorUpdate
  {
    string      name;
    UpdateType  type;
    long        repo_id;
    long        repo_type;
    SequenceNum seq_num;
  };

  exception InvalidPeer
  {
    string reason;
  };

  interface UpdatePushNotification
  {
    /// indicate existing server with name was updated
    oneway void notify_updated_server(in ServerUpdate server);

    /// indicate existing activator with name was updated
    //oneway void notify_updated_activator(in ActivatorUpdate activator);
    oneway void notify_updated_activator(in ActivatorUpdate activator);

    /// register peer as replica and indicate sequence number
    void register_replica(in UpdatePushNotification peer,
                          inout string ft_imr_ior,
                          out SequenceNum seq_num)
      raises (InvalidPeer);
  };
};

