Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

txn_method.c

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1996-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: txn_method.c,v 12.2 2005/07/21 18:21:45 bostic Exp $
00008  */
00009 
00010 #include "db_config.h"
00011 
00012 #ifndef NO_SYSTEM_INCLUDES
00013 #include <sys/types.h>
00014 
00015 #include <string.h>
00016 #endif
00017 
00018 #include "db_int.h"
00019 #include "dbinc/txn.h"
00020 
00021 /*
00022  * __txn_dbenv_create --
00023  *      Transaction specific initialization of the DB_ENV structure.
00024  *
00025  * PUBLIC: void __txn_dbenv_create __P((DB_ENV *));
00026  */
00027 void
00028 __txn_dbenv_create(dbenv)
00029         DB_ENV *dbenv;
00030 {
00031         /*
00032          * !!!
00033          * Our caller has not yet had the opportunity to reset the panic
00034          * state or turn off mutex locking, and so we can neither check
00035          * the panic state or acquire a mutex in the DB_ENV create path.
00036          */
00037         dbenv->tx_max = DEF_MAX_TXNS;
00038 }
00039 
00040 /*
00041  * PUBLIC: int __txn_get_tx_max __P((DB_ENV *, u_int32_t *));
00042  */
00043 int
00044 __txn_get_tx_max(dbenv, tx_maxp)
00045         DB_ENV *dbenv;
00046         u_int32_t *tx_maxp;
00047 {
00048         ENV_NOT_CONFIGURED(dbenv,
00049             dbenv->tx_handle, "DB_ENV->get_tx_max", DB_INIT_TXN);
00050 
00051         if (TXN_ON(dbenv)) {
00052                 /* Cannot be set after open, no lock required to read. */
00053                 *tx_maxp = ((DB_TXNREGION *)
00054                     ((DB_TXNMGR *)dbenv->tx_handle)->reginfo.primary)->maxtxns;
00055         } else
00056                 *tx_maxp = dbenv->tx_max;
00057         return (0);
00058 }
00059 
00060 /*
00061  * __txn_set_tx_max --
00062  *      DB_ENV->set_tx_max.
00063  *
00064  * PUBLIC: int __txn_set_tx_max __P((DB_ENV *, u_int32_t));
00065  */
00066 int
00067 __txn_set_tx_max(dbenv, tx_max)
00068         DB_ENV *dbenv;
00069         u_int32_t tx_max;
00070 {
00071         ENV_ILLEGAL_AFTER_OPEN(dbenv, "DB_ENV->set_tx_max");
00072 
00073         dbenv->tx_max = tx_max;
00074         return (0);
00075 }
00076 
00077 /*
00078  * PUBLIC: int __txn_get_tx_timestamp __P((DB_ENV *, time_t *));
00079  */
00080 int
00081 __txn_get_tx_timestamp(dbenv, timestamp)
00082         DB_ENV *dbenv;
00083         time_t *timestamp;
00084 {
00085         *timestamp = dbenv->tx_timestamp;
00086         return (0);
00087 }
00088 
00089 /*
00090  * __txn_set_tx_timestamp --
00091  *      Set the transaction recovery timestamp.
00092  *
00093  * PUBLIC: int __txn_set_tx_timestamp __P((DB_ENV *, time_t *));
00094  */
00095 int
00096 __txn_set_tx_timestamp(dbenv, timestamp)
00097         DB_ENV *dbenv;
00098         time_t *timestamp;
00099 {
00100         ENV_ILLEGAL_AFTER_OPEN(dbenv, "DB_ENV->set_tx_timestamp");
00101 
00102         dbenv->tx_timestamp = *timestamp;
00103         return (0);
00104 }

Generated on Sun Dec 25 12:14:56 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2