2 * Copyright (c) 2002-2005 MontaVista Software, Inc.
6 * Author: Steven Dake (sdake@mvista.com)
8 * This software licensed under BSD license, the text of which follows:
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
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
;
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 }
80 SaCkptSectionIdT
*sectionId
;
81 SaTimeT expirationTime
;
82 } SaCkptSectionCreationAttributesT
;
85 SA_CKPT_SECTION_VALID
= 1,
86 SA_CKPT_SECTION_CORRUPTED
= 2
87 } SaCkptSectionStateT
;
90 SaCkptSectionIdT sectionId
;
91 SaTimeT expirationTime
;
93 SaCkptSectionStateT sectionState
;
95 } SaCkptSectionDescriptorT
;
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
;
108 SaCkptSectionIdT sectionId
;
111 SaOffsetT dataOffset
;
113 } SaCkptIOVectorElementT
;
116 SaCkptCheckpointCreationAttributesT checkpointCreationAttributes
;
117 SaUint32T numberOfSections
;
118 SaUint32T memoryUsed
;
119 } SaCkptCheckpointDescriptorT
;
121 typedef void (*SaCkptCheckpointOpenCallbackT
) (
122 SaInvocationT invocation
,
123 const SaCkptCheckpointHandleT checkpointHandle
,
126 typedef void (*SaCkptCheckpointSynchronizeCallbackT
) (
127 SaInvocationT invocation
,
131 SaCkptCheckpointOpenCallbackT saCkptCheckpointOpenCallback
;
132 SaCkptCheckpointSynchronizeCallbackT saCkptCheckpointSynchronizeCallback
;
138 SaCkptHandleT
*ckptHandle
,
139 const SaCkptCallbacksT
*callbacks
,
140 SaVersionT
*version
);
143 saCkptSelectionObjectGet (
144 SaCkptHandleT ckptHandle
,
145 SaSelectionObjectT
*selectionObject
);
149 SaCkptHandleT ckptHandle
,
150 SaDispatchFlagsT dispatchFlags
);
154 SaCkptHandleT ckptHandle
);
157 saCkptCheckpointOpen (
158 SaCkptHandleT ckptHandle
,
159 const SaNameT
*checkpointName
,
160 const SaCkptCheckpointCreationAttributesT
*checkpointCreationAttributes
,
161 SaCkptCheckpointOpenFlagsT checkpointOpenFlags
,
163 SaCkptCheckpointHandleT
*checkpointHandle
);
166 saCkptCheckpointOpenAsync (
167 SaCkptHandleT ckptHandle
,
168 SaInvocationT invocation
,
169 const SaNameT
*checkpointName
,
170 const SaCkptCheckpointCreationAttributesT
*checkpointCreationAttributes
,
171 SaCkptCheckpointOpenFlagsT checkpointOpenFlags
);
174 saCkptCheckpointClose (
175 SaCkptCheckpointHandleT checkpointHandle
);
178 saCkptCheckpointUnlink (
179 SaCkptHandleT ckptHandle
,
180 const SaNameT
*checkpointName
);
183 saCkptCheckpointRetentionDurationSet (
184 SaCkptCheckpointHandleT checkpointHandle
,
185 SaTimeT retentionDuration
);
188 saCkptActiveReplicaSet (
189 const SaCkptCheckpointHandleT checkpointHandle
);
192 saCkptCheckpointStatusGet (
193 SaCkptCheckpointHandleT checkpointHandle
,
194 SaCkptCheckpointDescriptorT
*checkpointStatus
);
197 saCkptSectionCreate (
198 SaCkptCheckpointHandleT checkpointHandle
,
199 SaCkptSectionCreationAttributesT
*sectionCreationAttributes
,
200 const void *initialData
,
201 SaUint32T initialDataSize
);
205 saCkptSectionDelete (
206 SaCkptCheckpointHandleT checkpointHandle
,
207 const SaCkptSectionIdT
*sectionId
);
210 saCkptSectionExpirationTimeSet (
211 SaCkptCheckpointHandleT checkpointHandle
,
212 const SaCkptSectionIdT
*sectionId
,
213 SaTimeT expirationTime
);
216 saCkptSectionIterationInitialize (
217 const SaCkptCheckpointHandleT checkpointHandle
,
218 SaCkptSectionsChosenT sectionsChosen
,
219 SaTimeT expirationTime
,
220 SaCkptSectionIterationHandleT
*sectionIterationHandle
);
223 saCkptSectionIterationNext (
224 SaCkptSectionIterationHandleT sectionIterationHandle
,
225 SaCkptSectionDescriptorT
*sectionDescriptor
);
228 saCkptSectionIterationFinalize (
229 SaCkptSectionIterationHandleT sectionIterationHandle
);
232 saCkptCheckpointWrite (
233 SaCkptCheckpointHandleT checkpointHandle
,
234 const SaCkptIOVectorElementT
*ioVector
,
235 SaUint32T numberOfElements
,
236 SaUint32T
*erroneousVectorIndex
);
239 saCkptSectionOverwrite (
240 SaCkptCheckpointHandleT checkpointHandle
,
241 const SaCkptSectionIdT
*secitonId
,
242 const void *dataBuffer
,
246 saCkptCheckpointRead (
247 SaCkptCheckpointHandleT checkpointHandle
,
248 SaCkptIOVectorElementT
*ioVector
,
249 SaUint32T numberOfElements
,
250 SaUint32T
*erroneousVectorIndex
);
253 saCkptCheckpointSynchronize (
254 SaCkptCheckpointHandleT checkpointHandle
,
258 saCkptCheckpointSynchronizeAsync (
259 SaCkptCheckpointHandleT checkpointHandle
,
260 SaInvocationT invocation
);
266 #endif /* SACKPT_H_DEFINED */