Patch to remove segfault on the exiting of a service.
[openais.git] / include / saCkpt.h
blobfc8d319c8a94b54d030ab21a214b8eea28eb1cd5
1 /*
2 * Copyright (c) 2002-2005 MontaVista Software, Inc.
4 * All rights reserved.
6 * Author: Steven Dake (sdake@mvista.com)
8 * This software licensed under BSD license, the text of which follows:
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
13 * - Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * - Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * - Neither the name of the MontaVista Software, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef SACKPT_H_DEFINED
36 #define SACKPT_H_DEFINED
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
43 typedef SaUint64T SaCkptHandleT;
45 typedef SaUint64T SaCkptCheckpointHandleT;
47 typedef SaUint64T SaCkptSectionIterationHandleT;
49 #define SA_CKPT_WR_ALL_REPLICAS 0x01
50 #define SA_CKPT_WR_ACTIVE_REPLICA 0x2
51 #define SA_CKPT_WR_ACTIVE_REPLICA_WEAK 0x4
52 #define SA_CKPT_CHECKPOINT_COLLOCATED 0x8
54 typedef SaUint32T SaCkptCheckpointCreationFlagsT;
56 typedef struct {
57 SaCkptCheckpointCreationFlagsT creationFlags;
58 SaSizeT checkpointSize;
59 SaTimeT retentionDuration;
60 SaUint32T maxSections;
61 SaSizeT maxSectionSize;
62 SaSizeT maxSectionIdSize;
63 } SaCkptCheckpointCreationAttributesT;
65 #define SA_CKPT_CHECKPOINT_READ 0x1
66 #define SA_CKPT_CHECKPOINT_WRITE 0x2
67 #define SA_CKPT_CHECKPOINT_CREATE 0x4
69 typedef SaUint32T SaCkptCheckpointOpenFlagsT;
71 #define SA_CKPT_DEFAULT_SECTION_ID { 0, 0 }
72 #define SA_CKPT_GENERATED_SECTION_ID { 0, 0 }
74 typedef struct {
75 SaUint16T idLen;
76 SaUint8T *id;
77 } SaCkptSectionIdT;
79 typedef struct {
80 SaCkptSectionIdT *sectionId;
81 SaTimeT expirationTime;
82 } SaCkptSectionCreationAttributesT;
84 typedef enum {
85 SA_CKPT_SECTION_VALID = 1,
86 SA_CKPT_SECTION_CORRUPTED = 2
87 } SaCkptSectionStateT;
89 typedef struct {
90 SaCkptSectionIdT sectionId;
91 SaTimeT expirationTime;
92 SaSizeT sectionSize;
93 SaCkptSectionStateT sectionState;
94 SaTimeT lastUpdate;
95 } SaCkptSectionDescriptorT;
97 typedef enum {
98 SA_CKPT_SECTIONS_FOREVER = 1,
99 SA_CKPT_SECTIONS_LEQ_EXPIRATION_TIME = 2,
100 SA_CKPT_SECTIONS_GEQ_EXPIRATION_TIME = 3,
101 SA_CKPT_SECTIONS_CORRUPTED = 4,
102 SA_CKPT_SECTIONS_ANY = 5
103 } SaCkptSectionsChosenT;
105 typedef SaUint64T SaOffsetT;
107 typedef struct {
108 SaCkptSectionIdT sectionId;
109 void *dataBuffer;
110 SaSizeT dataSize;
111 SaOffsetT dataOffset;
112 SaSizeT readSize;
113 } SaCkptIOVectorElementT;
115 typedef struct {
116 SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
117 SaUint32T numberOfSections;
118 SaUint32T memoryUsed;
119 } SaCkptCheckpointDescriptorT;
121 typedef void (*SaCkptCheckpointOpenCallbackT) (
122 SaInvocationT invocation,
123 const SaCkptCheckpointHandleT checkpointHandle,
124 SaAisErrorT error);
126 typedef void (*SaCkptCheckpointSynchronizeCallbackT) (
127 SaInvocationT invocation,
128 SaAisErrorT error);
130 typedef struct {
131 SaCkptCheckpointOpenCallbackT saCkptCheckpointOpenCallback;
132 SaCkptCheckpointSynchronizeCallbackT saCkptCheckpointSynchronizeCallback;
133 } SaCkptCallbacksT;
136 SaAisErrorT
137 saCkptInitialize (
138 SaCkptHandleT *ckptHandle,
139 const SaCkptCallbacksT *callbacks,
140 SaVersionT *version);
142 SaAisErrorT
143 saCkptSelectionObjectGet (
144 SaCkptHandleT ckptHandle,
145 SaSelectionObjectT *selectionObject);
147 SaAisErrorT
148 saCkptDispatch (
149 SaCkptHandleT ckptHandle,
150 SaDispatchFlagsT dispatchFlags);
152 SaAisErrorT
153 saCkptFinalize (
154 SaCkptHandleT ckptHandle);
156 SaAisErrorT
157 saCkptCheckpointOpen (
158 SaCkptHandleT ckptHandle,
159 const SaNameT *checkpointName,
160 const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
161 SaCkptCheckpointOpenFlagsT checkpointOpenFlags,
162 SaTimeT timeout,
163 SaCkptCheckpointHandleT *checkpointHandle);
165 SaAisErrorT
166 saCkptCheckpointOpenAsync (
167 SaCkptHandleT ckptHandle,
168 SaInvocationT invocation,
169 const SaNameT *checkpointName,
170 const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
171 SaCkptCheckpointOpenFlagsT checkpointOpenFlags);
173 SaAisErrorT
174 saCkptCheckpointClose (
175 SaCkptCheckpointHandleT checkpointHandle);
177 SaAisErrorT
178 saCkptCheckpointUnlink (
179 SaCkptHandleT ckptHandle,
180 const SaNameT *checkpointName);
182 SaAisErrorT
183 saCkptCheckpointRetentionDurationSet (
184 SaCkptCheckpointHandleT checkpointHandle,
185 SaTimeT retentionDuration);
187 SaAisErrorT
188 saCkptActiveReplicaSet (
189 const SaCkptCheckpointHandleT checkpointHandle);
191 SaAisErrorT
192 saCkptCheckpointStatusGet (
193 SaCkptCheckpointHandleT checkpointHandle,
194 SaCkptCheckpointDescriptorT *checkpointStatus);
196 SaAisErrorT
197 saCkptSectionCreate (
198 SaCkptCheckpointHandleT checkpointHandle,
199 SaCkptSectionCreationAttributesT *sectionCreationAttributes,
200 const void *initialData,
201 SaUint32T initialDataSize);
204 SaAisErrorT
205 saCkptSectionDelete (
206 SaCkptCheckpointHandleT checkpointHandle,
207 const SaCkptSectionIdT *sectionId);
209 SaAisErrorT
210 saCkptSectionExpirationTimeSet (
211 SaCkptCheckpointHandleT checkpointHandle,
212 const SaCkptSectionIdT *sectionId,
213 SaTimeT expirationTime);
215 SaAisErrorT
216 saCkptSectionIterationInitialize (
217 const SaCkptCheckpointHandleT checkpointHandle,
218 SaCkptSectionsChosenT sectionsChosen,
219 SaTimeT expirationTime,
220 SaCkptSectionIterationHandleT *sectionIterationHandle);
222 SaAisErrorT
223 saCkptSectionIterationNext (
224 SaCkptSectionIterationHandleT sectionIterationHandle,
225 SaCkptSectionDescriptorT *sectionDescriptor);
227 SaAisErrorT
228 saCkptSectionIterationFinalize (
229 SaCkptSectionIterationHandleT sectionIterationHandle);
231 SaAisErrorT
232 saCkptCheckpointWrite (
233 SaCkptCheckpointHandleT checkpointHandle,
234 const SaCkptIOVectorElementT *ioVector,
235 SaUint32T numberOfElements,
236 SaUint32T *erroneousVectorIndex);
238 SaAisErrorT
239 saCkptSectionOverwrite (
240 SaCkptCheckpointHandleT checkpointHandle,
241 const SaCkptSectionIdT *secitonId,
242 const void *dataBuffer,
243 SaSizeT dataSize);
245 SaAisErrorT
246 saCkptCheckpointRead (
247 SaCkptCheckpointHandleT checkpointHandle,
248 SaCkptIOVectorElementT *ioVector,
249 SaUint32T numberOfElements,
250 SaUint32T *erroneousVectorIndex);
252 SaAisErrorT
253 saCkptCheckpointSynchronize (
254 SaCkptCheckpointHandleT checkpointHandle,
255 SaTimeT timeout);
257 SaAisErrorT
258 saCkptCheckpointSynchronizeAsync (
259 SaCkptCheckpointHandleT checkpointHandle,
260 SaInvocationT invocation);
262 #ifdef __cplusplus
264 #endif
266 #endif /* SACKPT_H_DEFINED */