File:  [Coherent Logic Development] / freem / src / transact.h
Revision 1.1: download - view: text, annotated - select for diffs
Sun Jan 19 02:04:04 2025 UTC (8 months ago) by snw
Branches: MAIN
CVS tags: HEAD
Initial revision

    1: /*
    2:  *                            *
    3:  *                           * *
    4:  *                          *   *
    5:  *                     ***************
    6:  *                      * *       * *
    7:  *                       *  MUMPS  *
    8:  *                      * *       * *
    9:  *                     ***************
   10:  *                          *   *
   11:  *                           * *
   12:  *                            *
   13:  *
   14:  *   transact.h
   15:  *    Function prototypes, structs, and macros for FreeM
   16:  *    transaction support
   17:  *
   18:  *  
   19:  *   Author: Serena Willis <jpw@coherent-logic.com>
   20:  *    Copyright (C) 1998 MUG Deutschland
   21:  *    Copyright (C) 2020 Coherent Logic Development LLC
   22:  *
   23:  *
   24:  *   This file is part of FreeM.
   25:  *
   26:  *   FreeM is free software: you can redistribute it and/or modify
   27:  *   it under the terms of the GNU Affero Public License as published by
   28:  *   the Free Software Foundation, either version 3 of the License, or
   29:  *   (at your option) any later version.
   30:  *
   31:  *   FreeM is distributed in the hope that it will be useful,
   32:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   33:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   34:  *   GNU Affero Public License for more details.
   35:  *
   36:  *   You should have received a copy of the GNU Affero Public License
   37:  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
   38:  *
   39:  **/
   40: 
   41: #define TP_MAX_NEST 256
   42: #define TP_MAX_OPS 256
   43: 
   44: typedef struct tp_gblop {
   45: 
   46: 	/* does this operation represent a LOCK? */
   47: 	short is_lock;
   48: 
   49: 	/* flags presented to global(); action and 
   50: 	   data do not apply if is_lock == TRUE */
   51: 	short action;
   52: 	char key[256];
   53: 	char data[256];
   54: 
   55: } tp_gblop;
   56: 
   57: typedef struct tp_transaction {
   58: 
   59: 	/* transaction ID */
   60: 	char tp_id[256];
   61: 
   62: 	/* transaction flags */
   63: 	short serial;
   64: 	short restartable;
   65: 
   66: 	/* array of symbols to be restored on TRESTART */
   67: 	char sym_save[256][256];
   68: 
   69: 	int opcount;
   70: 
   71: 	tp_gblop ops[TP_MAX_OPS];
   72: 
   73: } tp_transaction;
   74: 
   75: extern int tp_committing;
   76: extern int tp_level;
   77: extern tp_transaction transactions[TP_MAX_NEST];
   78: extern void tp_init(void);
   79: extern short tp_get_sem(void);
   80: extern void tp_release_sem(void);
   81: extern int tp_tstart(char *tp_id, short serial, short restartable, char **sym_save);
   82: extern int tp_add_op(short islock, short action, char *key, char *data);
   83: extern int tp_tcommit(void);
   84: extern int tp_cleanup(int levels);
   85: extern int tp_trollback(int levels);
   86: extern int tp_trestart(void);
   87: extern void tp_tdump(void);
   88: extern void tp_get_op_name(char *buf, const short action);
   89: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>