@@ -88,10 +88,10 @@ typedef _Bool wsrep_bool_t; //!< should be the same as standard bool
88
88
/*! undefined seqno */
89
89
#define WSREP_SEQNO_UNDEFINED (-1)
90
90
91
- /*! wsrep status codes */
92
- typedef enum wsrep_status {
91
+ /*! wsrep provider status codes */
92
+ typedef enum wsrep_status
93
+ {
93
94
WSREP_OK = 0 , //!< success
94
- WSREP_APPLIER_EXIT , //!< success, applier marked to terminate
95
95
WSREP_WARNING , //!< minor warning, error logged
96
96
WSREP_TRX_MISSING , //!< transaction is not known by wsrep
97
97
WSREP_TRX_FAIL , //!< transaction aborted, server can continue
@@ -103,6 +103,19 @@ typedef enum wsrep_status {
103
103
WSREP_NOT_IMPLEMENTED //!< feature not implemented
104
104
} wsrep_status_t ;
105
105
106
+ /*! wsrep callbacks status codes */
107
+ typedef enum wsrep_cb_status
108
+ {
109
+ WSREP_CB_RETURN = -1 , //!< success, thread wants to return from wsrep::recv() call
110
+ WSREP_CB_SUCCESS = 0 , //!< success (as in "not critical failure")
111
+ WSREP_CB_FAILURE //!< critical failure (consistency violation)
112
+ /* Technically, wsrep provider has no use for specific failure codes since
113
+ * there is nothing it can do about it but abort execution. Therefore any
114
+ * positive number shall indicate a critical failure. Optionally that value
115
+ * may be used by provider to come to a consensus about state consistency
116
+ * in a group of nodes. */
117
+ } wsrep_cb_status_t ;
118
+
106
119
/*!
107
120
* @brief log severity levels, passed as first argument to log handler
108
121
*/
@@ -130,7 +143,7 @@ typedef void (*wsrep_log_cb_t)(wsrep_log_level_t, const char *);
130
143
* UUID type - for all unique IDs
131
144
*/
132
145
typedef struct wsrep_uuid {
133
- uint8_t uuid [16 ];
146
+ uint8_t data [16 ];
134
147
} wsrep_uuid_t ;
135
148
136
149
/*! Undefined UUID */
@@ -234,8 +247,7 @@ typedef enum wsrep_view_status {
234
247
* view of the group
235
248
*/
236
249
typedef struct wsrep_view_info {
237
- wsrep_uuid_t uuid ; //!< global state UUID
238
- wsrep_seqno_t seqno ; //!< global state seqno
250
+ wsrep_gtid_t state_id ; //!< global state ID
239
251
wsrep_seqno_t view ; //!< global view number
240
252
wsrep_view_status_t status ; //!< view status
241
253
wsrep_bool_t state_gap ; //!< gap between global and local states
@@ -282,13 +294,15 @@ typedef struct wsrep_view_info {
282
294
* @param sst_req_len location to store SST request length or error code
283
295
* value of 0 means no SST.
284
296
*/
285
- typedef void (* wsrep_view_cb_t ) (void * app_ctx ,
286
- void * recv_ctx ,
287
- const wsrep_view_info_t * view ,
288
- const char * state ,
289
- size_t state_len ,
290
- void * * sst_req ,
291
- int * sst_req_len );
297
+ typedef enum wsrep_cb_status (* wsrep_view_cb_t ) (
298
+ void * app_ctx ,
299
+ void * recv_ctx ,
300
+ const wsrep_view_info_t * view ,
301
+ const char * state ,
302
+ size_t state_len ,
303
+ void * * sst_req ,
304
+ int * sst_req_len
305
+ );
292
306
293
307
/*!
294
308
* @brief apply callback
@@ -306,11 +320,12 @@ typedef void (*wsrep_view_cb_t) (void* app_ctx,
306
320
* @retval WSREP_NOT_IMPLEMENTED appl. does not support the writeset format
307
321
* @retval WSREP_ERROR failed to apply the writeset
308
322
*/
309
- typedef enum wsrep_status (* wsrep_apply_cb_t ) (
323
+ typedef enum wsrep_cb_status (* wsrep_apply_cb_t ) (
310
324
void * recv_ctx ,
311
325
const void * data ,
312
326
size_t size ,
313
- const wsrep_trx_meta_t * meta );
327
+ const wsrep_trx_meta_t * meta
328
+ );
314
329
315
330
/*!
316
331
* @brief commit callback
@@ -325,10 +340,11 @@ typedef enum wsrep_status (*wsrep_apply_cb_t) (
325
340
* @retval WSREP_OK
326
341
* @retval WSREP_ERROR call failed
327
342
*/
328
- typedef enum wsrep_status (* wsrep_commit_cb_t ) (
343
+ typedef enum wsrep_cb_status (* wsrep_commit_cb_t ) (
329
344
void * recv_ctx ,
330
345
const wsrep_trx_meta_t * meta ,
331
- wsrep_bool_t commit );
346
+ wsrep_bool_t commit
347
+ );
332
348
333
349
/*!
334
350
* @brief unordered callback
@@ -344,9 +360,9 @@ typedef enum wsrep_status (*wsrep_commit_cb_t) (
344
360
* @retval WSREP_OK
345
361
* @retval WSREP_ERROR call failed
346
362
*/
347
- typedef enum wsrep_status (* wsrep_unordered_cb_t ) (void * recv_ctx ,
348
- const void * data ,
349
- size_t size );
363
+ typedef enum wsrep_cb_status (* wsrep_unordered_cb_t ) (void * recv_ctx ,
364
+ const void * data ,
365
+ size_t size );
350
366
351
367
/*!
352
368
* @brief a callback to donate state snapshot
@@ -361,8 +377,7 @@ typedef enum wsrep_status (*wsrep_unordered_cb_t) (void* recv_ctx,
361
377
* @param recv_ctx receiver context
362
378
* @param msg state transfer request message
363
379
* @param msg_len state transfer request message length
364
- * @param uuid current state uuid on this node
365
- * @param seqno current state seqno on this node
380
+ * @param gtid current state ID on this node
366
381
* @param state current wsrep internal state buffer
367
382
* @param state_len current wsrep internal state buffer len
368
383
* @param bypass bypass snapshot transfer, only transfer uuid:seqno pair
@@ -372,8 +387,7 @@ typedef int (*wsrep_sst_donate_cb_t) (void* app_ctx,
372
387
void * recv_ctx ,
373
388
const void * msg ,
374
389
size_t msg_len ,
375
- const wsrep_uuid_t * uuid ,
376
- wsrep_seqno_t seqno ,
390
+ const wsrep_gtid_t * state_id ,
377
391
const char * state ,
378
392
size_t state_len ,
379
393
wsrep_bool_t bypass );
@@ -406,8 +420,7 @@ struct wsrep_init_args
406
420
int proto_ver ; //!< Max supported application protocol version
407
421
408
422
/* Application initial state information. */
409
- const wsrep_uuid_t * state_uuid ; //!< Application state sequence UUID
410
- wsrep_seqno_t state_seqno ; //!< Applicaiton state sequence number
423
+ const wsrep_gtid_t * state_id ; //!< Application state ID
411
424
const char * state ; //!< Initial state for wsrep implementation
412
425
size_t state_len ; //!< Length of state buffer
413
426
@@ -840,29 +853,27 @@ struct wsrep_ {
840
853
* @brief Signals to wsrep provider that state snapshot has been sent to
841
854
* joiner.
842
855
*
843
- * @param wsrep provider handle
844
- * @param uuid sequence UUID (group UUID)
845
- * @param seqno sequence number or negative error code of the operation
856
+ * @param wsrep provider handle
857
+ * @param state_id state ID
846
858
*/
847
859
wsrep_status_t (* sst_sent )(wsrep_t * wsrep ,
848
- const wsrep_uuid_t * uuid ,
849
- wsrep_seqno_t seqno );
860
+ const wsrep_gtid_t * state_id );
850
861
851
862
/*!
852
863
* @brief Signals to wsrep provider that new state snapshot has been received.
853
864
* May deadlock if called from sst_prepare_cb.
854
865
*
855
866
* @param wsrep provider handle
856
- * @param uuid sequence UUID (group UUID)
857
- * @param seqno sequence number or negative error code of the operation
867
+ * @param state_id state ID
858
868
* @param state initial state provided by SST donor
859
869
* @param state_len length of state buffer
870
+ * @param rcode 0 or negative error code of the operation.
860
871
*/
861
872
wsrep_status_t (* sst_received )(wsrep_t * wsrep ,
862
- const wsrep_uuid_t * uuid ,
863
- wsrep_seqno_t seqno ,
873
+ const wsrep_gtid_t * state_id ,
864
874
const char * state ,
865
- size_t state_len );
875
+ size_t state_len ,
876
+ int rcode );
866
877
867
878
868
879
/*!
0 commit comments