NCS_EPOCH_CHANGE_CALLBACK

Points to a callback function that triggers an application to perform any node join or leave operation.

Syntax

 #include <ncssdk.h> 
  
 typedef void (NCS_EPOCH_CHANGE_CALLBACK)  
 ( 
    NCS_HANDLE   Handle,
    UINT32       GroupEpoch,
    UINT32       Members,
    UINT32       FailedMask,
    UINT32       MasterMask
 );
 

Parameters

Handle

(OUT) Returns the Novell Cluster Service handle necessary to access the NCS SDK.Once an application is cluster enabled and instantiated on a node, it registers itself with NCS by calling NCS_Register and returns the handle.

NOTE:Every time you want to invoke a function call, you must pass in the handle. Handlers can discard any callbacks if the handle provided here is different from that specified by NCS_Register.

GroupEpoch

(OUT) Returns the group epoch number. Epoch is a simplified time stamp. Each time a node leaves or joins a cluster, the epoch number increases by one.

Members

(OUT) Returns a 32-bit integer bit mask identifying the nodes that are in the cluster right now.

FailedMask

(OUT) Returns a 32-bit integer bit mask identifying the nodes that has failed in since the last epoch callback.

MasterMask

(OUT) Returns a 32-bit integer bit mask identifying the node that is the master of the cluster.

Remarks

NCS_EPOCH_CHANGE_CALLBACK is registered by calling NCS_Register. NCS calls this function on all nodes that are currently in the cluster when a node joins or leaves the cluster.

Novell Cluster Services invokes NCS_EPOCH_CHANGE_CALLBACK to alert cluster-enabled applications that a node has joined or left a cluster. This function is called when any node either joins or leaves the cluster, and provides the signal to the application to perform any node join/leave operations.

This would occur, for example, in cases of leave schedule, the shutdown of handler threads, or free memory. It also releases the shared state associated with the leaving nodes. Members include:

  • For every bit = 1, represents the node is part of the cluster

  • For every bit = 0, represents the node is not part of the cluster

  • If MEMBERS = 0, the node itself is leaving the cluster

NOTE:If your application is using the distributed lock API functions, and the node you are running on leaves the cluster, the application will receive an NCS_EPOCH_CHANGE_CALLBACK. The application must then deregister with the SDK then reregister. At the time the application reregisters, the server may not be a current member of the cluster, in which case the API will return an error indicating that the application is not a cluster member. Consequently, the application will need to continue polling the cluster until it is accepted.