2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 2000-2002
5
* Sleepycat Software. All rights reserved.
10
#ifndef _DB_SERVER_INT_H_
11
#define _DB_SERVER_INT_H_
13
#define DB_SERVER_TIMEOUT 300 /* 5 minutes */
14
#define DB_SERVER_MAXTIMEOUT 1200 /* 20 minutes */
15
#define DB_SERVER_IDLETIMEOUT 86400 /* 1 day */
18
* Ignore/mask off the following env->open flags:
19
* Most are illegal for a client to specify as they would control
20
* server resource usage. We will just ignore them.
26
* DB_USE_ENVIRON, DB_USE_ENVIRON_ROOT - handled on client
28
#define DB_SERVER_FLAGMASK ( \
29
DB_LOCKDOWN | DB_PRIVATE | DB_RECOVER | DB_RECOVER_FATAL | \
30
DB_SYSTEM_MEM | DB_USE_ENVIRON | DB_USE_ENVIRON_ROOT)
32
#define CT_CURSOR 0x001 /* Cursor */
33
#define CT_DB 0x002 /* Database */
34
#define CT_ENV 0x004 /* Env */
35
#define CT_TXN 0x008 /* Txn */
37
#define CT_JOIN 0x10000000 /* Join cursor component */
38
#define CT_JOINCUR 0x20000000 /* Join cursor */
40
typedef struct home_entry home_entry;
42
LIST_ENTRY(home_entry) entries;
50
* Data needed for sharing handles.
51
* To share an env handle, on the open call, they must have matching
52
* env flags, and matching set_flags.
54
* To share a db handle on the open call, the db, subdb and flags must
57
#define DB_SERVER_ENVFLAGS ( \
58
DB_INIT_CDB | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | \
59
DB_INIT_TXN | DB_JOINENV)
61
#define DB_SERVER_DBFLAGS (DB_DIRTY_READ | DB_NOMMAP | DB_RDONLY)
62
#define DB_SERVER_DBNOSHARE (DB_EXCL | DB_TRUNCATE)
64
typedef struct ct_envdata ct_envdata;
65
typedef struct ct_dbdata ct_dbdata;
82
* We maintain an activity timestamp for each handle. However, we
83
* set it to point, possibly to the ct_active field of its own handle
84
* or it may point to the ct_active field of a parent. In the case
85
* of nested transactions and any cursors within transactions it must
86
* point to the ct_active field of the ultimate parent of the transaction
87
* no matter how deeply it is nested.
89
typedef struct ct_entry ct_entry;
91
LIST_ENTRY(ct_entry) entries; /* List of entries */
94
DbEnv *envp; /* H_ENV */
95
DbTxn *txnp; /* H_TXN */
97
Dbc *dbc; /* H_CURSOR */
99
DB_ENV *envp; /* H_ENV */
100
DB_TXN *txnp; /* H_TXN */
102
DBC *dbc; /* H_CURSOR */
106
union { /* Private data per type */
107
ct_envdata envdp; /* Env info */
108
ct_dbdata dbdp; /* Db info */
110
long ct_id; /* Client ID */
111
long *ct_activep; /* Activity timestamp pointer*/
112
long *ct_origp; /* Original timestamp pointer*/
113
long ct_active; /* Activity timestamp */
114
long ct_timeout; /* Resource timeout */
115
long ct_idle; /* Idle timeout */
116
u_int32_t ct_refcount; /* Ref count for sharing */
117
u_int32_t ct_type; /* This entry's type */
118
struct ct_entry *ct_parent; /* Its parent */
119
struct ct_entry *ct_envparent; /* Its environment */
122
#define ct_envp handle_u.envp
123
#define ct_txnp handle_u.txnp
124
#define ct_dbp handle_u.dbp
125
#define ct_dbc handle_u.dbc
126
#define ct_anyp handle_u.anyp
128
#define ct_envdp private_u.envdp
129
#define ct_dbdp private_u.dbdp
131
extern int __dbsrv_verbose;
134
* Get ctp and activate it.
135
* Assumes local variable 'replyp'.
136
* NOTE: May 'return' from macro.
138
#define ACTIVATE_CTP(ctp, id, type) { \
139
(ctp) = get_tableent(id); \
140
if ((ctp) == NULL) { \
141
replyp->status = DB_NOSERVER_ID;\
144
DB_ASSERT((ctp)->ct_type & (type)); \
145
__dbsrv_active(ctp); \
148
#endif /* !_DB_SERVER_INT_H_ */