OpenClovis Logo

clCachedCkpt.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 /*******************************************************************************
21  * ModuleName : ckpt
22  * File : clCachedCkpt.h
23  *******************************************************************************/
24 
25 /*******************************************************************************
26  * Description :
27  * This file contains essential definitions for the Cached Checkpoint
28  * which provides a fast lookup for a P2P generated database.
29  *
30  *
31  *******************************************************************************/
32 
45 #ifndef _CL_CACHED_CKPT_H_
46 #define _CL_CACHED_CKPT_H_
47 
48 #include <clCommon.h>
49 #include <clCommonErrors.h>
50 #include <clHash.h>
51 #include <clIocApi.h>
52 #include <clOsalApi.h>
53 #include <saCkpt.h>
54 #include <clCkptApi.h>
55 
56 #ifdef __cplusplus
57 extern "C"
58 {
59 #endif
60 
61 /*******************************************************************************/
62 #define CL_CACHED_CKPT_MAX_SECTION 1024
63 
64 #define CL_CACHED_CKPT_SHM_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
65 #define CL_CACHED_CKPT_SHM_OPEN_FLAGS (O_RDWR)
66 #define CL_CACHED_CKPT_SHM_CREATE_FLAGS (O_RDWR | O_CREAT)
67 #define CL_CACHED_CKPT_SHM_EXCL_CREATE_FLAGS (O_RDWR | O_CREAT | O_EXCL)
68 #define CL_CACHED_CKPT_MMAP_FLAGS (MAP_SHARED)
69 #define CL_CACHED_CKPT_MMAP_PROT_FLAGS (PROT_READ | PROT_WRITE)
70 
74 typedef struct {
86  ClUint32T dataSize;
90  ClUint8T *data;
91 
93 
94 
95 
99 typedef struct {
103  ClInt32T fd;
111  SaCkptHandleT ckptSvcHandle;
115  SaCkptCheckpointHandleT ckptHandle;
119  ClUint32T cachSize;
123  ClUint8T *cache;
125 
126 /*******************************************************************************/
127 
128 /************************* CACHED CHECKPOINT APIs ******************************/
129 
168  const SaNameT *ckptName,
169  const SaCkptCheckpointCreationAttributesT *ckptAttributes,
170  SaCkptCheckpointOpenFlagsT openFlags,
171  ClUint32T cachSize);
172 /*******************************************************************************/
173 
174 
201 /*******************************************************************************/
202 
203 
236  const ClCachedCkptDataT *sectionData);
237 /*******************************************************************************/
238 
239 
271  const ClCachedCkptDataT *sectionData);
272 /*******************************************************************************/
273 
274 
305  const ClNameT *sectionName);
306 /*******************************************************************************/
307 
332  const ClNameT *sectionName,
333  ClCachedCkptDataT **sectionData);
334 
360  ClCachedCkptDataT **sectionData,
361  ClUint32T *sectionOffset);
362 
387  ClCachedCkptDataT **sectionData,
388  ClUint32T *sectionOffset);
389 
390 /*******************************************************************************/
391 
413 ClRcT clCachedCkptSynch(ClCachedCkptSvcInfoT *serviceInfo, ClBoolT isEmpty);
414 /*******************************************************************************/
415 
416 /* Functions to update cache */
417 ClRcT clCacheEntryAdd (ClCachedCkptSvcInfoT *serviceInfo,
418  const ClCachedCkptDataT *sectionData);
419 ClRcT clCacheEntryUpdate (ClCachedCkptSvcInfoT *serviceInfo,
420  const ClCachedCkptDataT *sectionData);
421 ClRcT clCacheEntryDelete (ClCachedCkptSvcInfoT *serviceInfo,
422  const ClNameT *sectionName);
423 
424 /* Functions to update checkpoint */
425 ClRcT clCkptEntryUpdate(ClCachedCkptSvcInfoT *serviceInfo,
426  const ClCachedCkptDataT *sectionData);
427 ClRcT clCkptEntryDelete(ClCachedCkptSvcInfoT *serviceInfo, const ClNameT *sectionName);
428 
429 /****************************Client Side APIs**************************/
433 typedef struct {
437  ClInt32T fd;
445  ClUint32T cachSize;
449  ClUint8T *cache;
451 
452 void clCachedCkptClientLookup(ClCachedCkptClientSvcInfoT *serviceInfo,
453  const ClNameT *sectionName,
454  ClCachedCkptDataT **sectionData);
455 ClRcT clCachedCkptClientInitialize(ClCachedCkptClientSvcInfoT *serviceInfo,
456  const ClNameT *ckptName,
457  ClUint32T cachSize);
458 ClRcT clCachedCkptClientFinalize(ClCachedCkptClientSvcInfoT *serviceInfo);
459 
460 
461 
462 #ifdef __cplusplus
463 }
464 #endif
465 
466 #endif /* _CL_CACHED_CKPT_H_ */
467 

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