The initialization Interface (Part of Server Process)



Data Structures:

There are three RPC services defined in this interface :

    Client for the first service,boot_up_1_svc() is the join process which executes on the same machine as that of the co-ordinator process. This service is responsible for doing all the initialization of the coordinator and getting an nodeId for it.
The algorithms of these three service are given below.
 

int* boot_up_1_svc(int isFirstNode)

    Arguments : The integer variable isFirstNode that tells whether the coordinator is the  first on to come up.

    Returns : The function returns the status value obtained after calling the function broadcast_join() on other co-ordinators from within this function.

    At Client side:
        The client for this service is the boot-Up process. The first RPC service, boot_up_1_svc() is called by the join process after starting the co-ordinator. The calling routine is present at the same place where the co-ordinator is running. Show details

    At the Server Side:
        The call is received by the co-ordinator at the same node as the bootup-process.
The following steps are then followed by the co-ordinator within this function:

NodeArr* broadcast_subscribe_1_svc(StrArr* strArr)

Arguments : The string array consisting of the information about the machine.
Returns : Co-ordinators return different values depending on the fact whether they
            are the last one in the ARC ring or not.( See details below )

At Client side:
    This function is called from within the function boot_up_1_svc() of the new coordinator that wants to join the ARC ring. The service broadcast_subscribe_1_svc(StrArr* strArr) is called on each of the existing co-ordinators to tell them that it wishes to join the ARC ring. This is actually to broadcast a "subscribe-request". The new node supplies its identity as an array argument in the functions, which contains the information read from the file "kernel/src/coordinator/node_inf_file". The return value of this function depends on the node that is responding to the broadcast-request. (Explained below)

At Server side:
    All the existing co-ordinators receive this request. The co-ordinator on
receiving this call create a new entry in their list of nodes for the new
up-coming node. Then the co-ordinator checks the status of the flag, globLastMe to find if it is the last one in ARC ring. If not, it sends a dummy array back to the calling process. If yes then do the following :


int* broadcast_join_1_svc(Node* node)

Arguments : A data-structure of type Node that contains the id and details about
                the co-ordinator that call this function.

Returns : Highest sequence number in the array of co-ordinators.

At client side:
    The call to this service is made from within the boot_up_1_svc() service of
the co-ordinator on each of the existing co-ordinators to tell them that it has
actually joined the ARC ring. The argument to the function is a node structure that
describes about the details of the machine on which the co-ordinator is running.

At Server side:
    At the server receiving this request: The existing servers that receive this request
update their data-structures to reflect the join of the new node that indicates that
the new node is now ready. If the monitor process running at the coordinator is not monitoring any node(this happens if the coordinator is the only one present in the ARC ring), then it will now start monitoring the newly come-up coordinator. The monitor process at the coordinator is informed about this by sending it a message through message queue.
 
 

Following are the helper functions.