![]() |
|
|||
0001 /** 0002 * @brief Transaction support for queue 0003 * 0004 * @file qtran.h 0005 */ 0006 /* ----------------------------------------------------------------------------- 0007 * Enduro/X Middleware Platform for Distributed Transaction Processing 0008 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0009 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0010 * This software is released under one of the following licenses: 0011 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0012 * See LICENSE file for full text. 0013 * ----------------------------------------------------------------------------- 0014 * AGPL license: 0015 * 0016 * This program is free software; you can redistribute it and/or modify it under 0017 * the terms of the GNU Affero General Public License, version 3 as published 0018 * by the Free Software Foundation; 0019 * 0020 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0022 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0023 * for more details. 0024 * 0025 * You should have received a copy of the GNU Affero General Public License along 0026 * with this program; if not, write to the Free Software Foundation, Inc., 0027 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0028 * 0029 * ----------------------------------------------------------------------------- 0030 * A commercial use license is available from Mavimax, Ltd 0031 * contact@mavimax.com 0032 * ----------------------------------------------------------------------------- 0033 */ 0034 0035 #ifndef QTRAN_H 0036 #define QTRAN_H 0037 0038 #ifdef __cplusplus 0039 extern "C" { 0040 #endif 0041 0042 /*---------------------------Includes-----------------------------------*/ 0043 #include <xa_cmn.h> 0044 #include <atmi.h> 0045 #include <utlist.h> 0046 #include <exhash.h> 0047 #include <exthpool.h> 0048 #include "tmqueue.h" 0049 0050 /*---------------------------Externs------------------------------------*/ 0051 /*---------------------------Macros-------------------------------------*/ 0052 /*---------------------------Enums--------------------------------------*/ 0053 /*---------------------------Typedefs-----------------------------------*/ 0054 0055 /** 0056 * Command block entry in the log 0057 * Any references to msg are stored in b 0058 */ 0059 typedef struct qtran_log_cmd qtran_log_cmd_t; 0060 struct qtran_log_cmd 0061 { 0062 char command_code; /**< Command code */ 0063 int seqno; /**< Command sequence number */ 0064 char cmd_status; /**< status according to XA_RM_STATUS* */ 0065 int no_unlock; /**< do not unlock the msg */ 0066 union tmq_upd_block b; /**< Update block (largest metadata store */ 0067 qtran_log_cmd_t *prev, *next;/**< DL list of locked / related msgs */ 0068 }; 0069 0070 /** 0071 * Queue transaction support 0072 */ 0073 struct qtran_log 0074 { 0075 char tmxid[NDRX_XID_SERIAL_BUFSIZE+1]; /**< tmxid, serialized */ 0076 0077 /* Log the date & time with transaction is open */ 0078 unsigned long long t_start; /**< when tx started */ 0079 unsigned long long t_update; /**< wehn tx updated (last) */ 0080 0081 short txstage; /**< In what state we are */ 0082 0083 /* background processing: */ 0084 long trycount; /**< Number of attempts */ 0085 0086 /* Have a timer for active transaction (to watch for time-outs) */ 0087 ndrx_stopwatch_t ttimer; /**< transaction timer */ 0088 0089 int is_background; /**< Is background responsible for tx? */ 0090 uint64_t lockthreadid; /**< Thread ID, locked the log entry */ 0091 0092 0093 int seqno; /**< Sequence counter */ 0094 int is_abort_only; /**< Is transaction broken? */ 0095 0096 long sg_sequence; /**< sequence number of signleton group */ 0097 0098 qtran_log_cmd_t *cmds; /**< List of queue commands within tran */ 0099 0100 EX_hash_handle hh; /**< makes this structure hashable */ 0101 }; 0102 typedef struct qtran_log qtran_log_t; 0103 0104 0105 /** 0106 * Transaction copy list 0107 */ 0108 typedef struct qtran_log_list qtran_log_list_t; 0109 struct qtran_log_list 0110 { 0111 qtran_log_t p_tl;/* copy of transaction */ 0112 qtran_log_list_t *next; 0113 }; 0114 0115 0116 /*---------------------------Globals------------------------------------*/ 0117 /*---------------------------Statics------------------------------------*/ 0118 /*---------------------------Prototypes---------------------------------*/ 0119 0120 extern qtran_log_t * tmq_log_get_entry(char *tmxid, int dowait, int *locke); 0121 extern int tmq_log_exists_entry(char *tmxid); 0122 extern int tmq_log_start(char *tmxid); 0123 extern qtran_log_t * tmq_log_start_or_get(char *tmxid); 0124 extern void tmq_log_set_abort_only(char *tmxid); 0125 extern int tmq_log_addcmd(char *tmxid, int seqno, char *b, char entry_status); 0126 extern void tmq_remove_logfree(qtran_log_t *p_tl, int hash_rm); 0127 extern qtran_log_list_t* tmq_copy_hash2list(int copy_mode); 0128 extern void tmq_tx_hash_lock(void); 0129 extern void tmq_tx_hash_unlock(void); 0130 extern int tmq_log_unlock(qtran_log_t *p_tl); 0131 extern int tmq_log_next(qtran_log_t *p_tl); 0132 extern int tmq_log_abortall(void); 0133 extern int tmq_log_setseq(qtran_log_t *p_tl); 0134 extern int tmq_log_checkpointseq(qtran_log_t *p_tl); 0135 0136 #ifdef __cplusplus 0137 } 0138 #endif 0139 0140 #endif /* QTRAN_H */ 0141 0142 /* vim: set ts=4 sw=4 et smartindent: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |