#ifndef _INCL_TRANS_H
/*
Basic structs for the DB transaction engine.
*/
/* This holds a datum for any of the transaction types */
typedef union {
char *name; /* Name of an object to delete */
/* Or link to */
struct {
Obj *obj; /* Object to insert */
char *name; /* its name */
} object;
struct {
char *this; /* Name of thing to insert/remove */
char *there; /* from here. */
} insdel;
struct {
char *to;
char *from;
char *who; /* from here. */
} linkchk;
} tr_opdata;
/* String these together to make a program for tr_exec() */
typedef struct tr_op {
int (*handler) ();
tr_opdata parm;
struct tr_op *next;
} tr_op;
/* This points to a list of tr_ops, of course. Geez. */
typedef struct {
tr_op *first; /* First operation of the program */
tr_op *last; /* Last operation of the program */
} tr_prog;
/* Flags for the various transaction handlers. */
#define TR_VALIDATE 0
#define TR_EXEC 1
#define TR_ABORT 2
/* The functions YOU use to get at transact.c */
extern tr_prog *tr_newprog(void);
extern void tr_addop ();
extern void tr_exec(tr_prog *prog);
extern void tr_abort(tr_prog *prog);
extern int tr_validate(tr_prog *prog);
extern void tr_addop(tr_prog *prog, tr_op *op);
/* The handlers for the various DB transactions */
extern int tr_newobj(tr_opdata *data, int flag);
extern int tr_delobj(tr_opdata *data, int flag);
extern int tr_zeroobj(tr_opdata *data, int flag);
extern int tr_insply(tr_opdata *data, int flag);
extern int tr_remply(tr_opdata *data, int flag);
extern int tr_addlink(tr_opdata *data, int flag);
#define _INCL_TRANS_H
#endif