OpenClovis Logo

clClmApi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2012 OpenClovis Solutions Inc. All Rights Reserved.
3  *
4  * This file is available under a commercial license from the
5  * copyright holder or the GNU General Public License Version 2.0.
6  *
7  * The source code for this program is not published or otherwise
8  * divested of its trade secrets, irrespective of what has been
9  * deposited with the U.S. Copyright office.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * For more information, see the file COPYING provided with this
17  * material.
18  */
19 /*******************************************************************************
20  * ModuleName : gms
21  * File : clGmsApi.h
22  *******************************************************************************/
23 
24 /*******************************************************************************
25  * Description :
26  * This client function implements the SA Forum compliant cluster membership
27  * management.
28  *
29  * Component Manager (CPM) uses these functions to manage its node in the cluster.
30  * This service assumes that there is only one cluster in the system.
31  *
32  * An instance of this service (instantiated by the clGmsInitialize()
33  * function and identified by the gmsHandle) can view and manage the cluster.
34  * If a node joins/leaves/kicked out of the cluster then all the other nodes
35  * in the cluster and its group components are updated with the current status.
36  *
37  *********************************************************************************/
38 
39 /*********************************************************************************/
40 /****************************** Group Management Service**************************/
41 /*********************************************************************************/
42 /* */
43 /* clGmsClusterJoin */
44 /* clGmsClusterJoinAsync */
45 /* clGmsClusterLeave */
46 /* clGmsClusterLeaveAsync */
47 /* clGmsClusterLeaderElect */
48 /* clGmsClusterMemberEject */
49 /* */
50 /**********************************************************************************/
51 
66 #ifndef _CL_GMS_API_H
67 #define _CL_GMS_API_H
68 
69 # ifdef __cplusplus
70 extern "C" {
71 # endif
72 
73 #include <clCommon.h>
74 #include <clClmTmsCommon.h>
75 
76 /*=========================================================================
77  * Callback Functions:
78  *=======================================================================*/
79 
105  CL_IN ClGmsMemberEjectReasonT reasonCode);
106 
114 typedef struct {
115 
120 
122 
136  ClGmsNodeIdT *leaderNodeId,
137  ClGmsNodeIdT *deputyNodeId,
138  ClGmsClusterMemberT *memberJoinedOrLeft,
139  ClGmsGroupChangesT cond
140  );
141 
142 
143 /*=========================================================================
144  * API Functions:
145  *=======================================================================*/
146 
147 /*
148  ************************************
149  * \brief Joins the cluster as a member.
150  *
151  * \par Header File:
152  * clGmsApi.h
153  *
154  * \param gmsHandle The handle, obtained through the clGmsInitialize() function,
155  * designating this particular initialization of the Group Membership Service.
156  * \param clusterManageCallbacks Callbacks for managing the cluster.
157  * \param credentials This is an integer value specifying the
158  * leadership credibility of the node. Larger the value higher is the
159  * possibility of the node becoming a leader. Member with creditials
160  * \c CL_GMS_INELIGIBLE_CREDENTIALS cannot participate in the leader election.
161  * \param timeout If the cluster join is not completed within this time,
162  * then the join request is timed out.
163  * \param nodeId Node ID of the member that will join the cluster.
164  * \param nodeName Name of the node that will join the cluster.
165  *
166  *
167  * \retval CL_ERR_INVALID_HANDLE If the handle passed to the function is not valid.
168  * The handle passed should have been obtained from the clGmsInitialize() function.
169  * \retval CL_ERR_TIMEOUT If the join request timed out.
170  * \retval CL_ERR_INVALID_PARAMETER If any of the input parameters are invalid.
171  * \retval CL_ERR_NULL_POINTER If either of the parameters \e clusterManageCallbacks
172  * or \e nodeName are NULL.
173  * \retval CL_ERR_TRY_AGAIN: GMS server is not ready to process the request.
174 
175  *
176  * \par Description:
177  * This function is used to include a node into the the cluster as a member.
178  * Success or failure is reported via return value
179  * Members who have registered for tracking, get notified by tracking callback.
180  *
181  * \par Library File:
182  * ClGms
183  *
184  * \sa clGmsClusterLeave()
185  *
186  */
187 extern ClRcT clGmsClusterJoin(
188  CL_IN const ClGmsHandleT gmsHandle,
189  CL_IN const ClGmsClusterManageCallbacksT* const clusterManageCallbacks,
190  CL_IN const ClGmsLeadershipCredentialsT credentials,
191  CL_IN const ClTimeT timeout,
192  CL_IN const ClGmsNodeIdT nodeId,
193  CL_IN const ClNameT* const nodeName);
194 
195 
196 /*
197  ************************************
198  * \brief Asynchronously joins the cluster as a member.
199  *
200  * \par Header File:
201  * clGmsApi.h
202  *
203  * \param gmsHandle The handle, obtained through the clGmsInitialize() function,
204  * designating this particular initialization of the Group Membership Service
205  * \param clusterManageCallbacks Callbacks for managing the cluster.
206  * \param credentials This is an integer value specifying the
207  * leadership credibility of the node. Larger the value higher is the
208  * possibility of the node becoming a leader. Member with creditials
209  * \c CL_GMS_INELIGIBLE_CREDENTIALS cannot participate in the leader election.
210  * \param timeout If the cluster join is not completed within this time,
211  * then the join request is timed out.
212  * \param nodeId Node ID of the member that will join the cluster.
213  * \param nodeName Name of the node that will join the cluster.
214  *
215  *
216  * \retval CL_ERR_INVALID_HANDLE If the handle passed to the function is not valid.
217  * The handle passed should have been obtained from the clGmsInitialize() function.
218  * \retval CL_GMS_ERR_JOIN_DENIED If the node is already part of the cluster.
219  * \retval CL_ERR_INVALID_PARAMETER If any of the input parameters are invalid.
220  * \retval CL_ERR_NULL_POINTER If either of the parameters \e clusterManageCallbacks
221  * or \e nodeName are NULL.
222  *
223  * \par Description:
224  * This function is used to asynchronously include a node into the cluster as a member.
225  * Success is reported via return value.
226  * Members that have registered for tracking get notified by tracking
227  * callback.
228  *
229  * \par Library File:
230  * ClGms
231  *
232  * \sa clGmsClusterJoin()
233  *
234  */
235 extern ClRcT clGmsClusterJoinAsync(
236  CL_IN const ClGmsHandleT gmsHandle,
237  CL_IN const ClGmsClusterManageCallbacksT* const clusterManageCallbacks,
238  CL_IN const ClGmsLeadershipCredentialsT credentials,
239  CL_IN const ClGmsNodeIdT nodeId,
240  CL_IN const ClNameT* const nodeName);
241 
242 
243 /*
244  ************************************
245  * \brief Leaves the cluster.
246  *
247  * \par Header File:
248  * clGmsApi.h
249  *
250  * \param gmsHandle The handle, obtained through the clGmsInitialize() function,
251  * designating this particular initialization of the Group Membership Service
252  * \param timeout If the cluster leave operation is not completed within this time,
253  * then the leave request is timed out.
254  * \param nodeId Node ID of the member that is leaving the cluster.
255  *
256  * \retval CL_ERR_INVALID_HANDLE If the handle passed to the function is not valid.
257  * The handle passed should have been obtained from the clGmsInitialize() function..
258  * \retval CL_ERR_INVALID_PARAMETER If any of the input parameters are invalid.
259  *
260  * \par Description:
261  * This function is used to make a node leave the cluster. Once the node leaves the cluster
262  * and the groups/components will be expelled and
263  * a reason for expulsion will be returned through their
264  * callback functions.
265  *
266  * \par Library File:
267  * ClGms
268  *
269  * \sa clGmsClusterJoin()
270  *
271  */
272 extern ClRcT clGmsClusterLeave(
273  CL_IN ClGmsHandleT gmsHandle,
274  CL_IN ClTimeT timeout,
275  CL_IN ClGmsNodeIdT nodeId);
276 
277 extern ClRcT clGmsClusterLeaveNative(
278  CL_IN ClGmsHandleT gmsHandle,
279  CL_IN ClTimeT timeout,
280  CL_IN ClGmsNodeIdT nodeId);
281 
282 
283 /*
284  ************************************
285  * \brief Leaves the cluster asynchronously.
286  *
287  * \par Header File:
288  * clGmsApi.h
289  *
290  * \param gmsHandle The handle, obtained through the clGmsInitialize() function,
291  * designating this particular initialization of the Group Membership Service
292  * \param nodeId Node ID of the member to be ejected out.
293  *
294  * \retval CL_ERR_INVALID_HANDLE If the handle passed to the function is not valid.
295  * The handle passed should have been obtained from the clGmsInitialize() function.
296  * \retval CL_ERR_INVALID_PARAMETER If any of the input parameters are invalid.
297  *
298  * \par Description:
299  * This function is used to make a node leave the cluster asynchronously. Once the node leaves the cluster
300  * and the groups/components will be expelled and
301  * a reason for expulsion will be returned through their
302  * callback functions.
303  *
304  * \par Library File:
305  * ClGms
306  *
307  * \sa clGmsClusterLeave()
308  *
309  */
310 extern ClRcT clGmsClusterLeaveAsync(
311  CL_IN ClGmsHandleT gmsHandle,
312  CL_IN ClGmsNodeIdT nodeId);
313 
314 
342  CL_IN ClGmsHandleT gmsHandle,
343  CL_IN ClGmsNodeIdT preferredLeader,
346  CL_INOUT ClBoolT *leadershipChanged);
347 
348 
349 
386  CL_IN ClGmsHandleT gmsHandle,
387  CL_IN ClGmsNodeIdT nodeId,
389 
390 
391 #ifdef __cplusplus
392 }
393 #endif
394 
395 #endif /* _CL_GMS_CLUSTER_MANAGE_API_H_ */
396 

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen