UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dblocks.h
Go to the documentation of this file.
1 /* dblocks.h */
2 /* $Id: dblocks.h,v 1.7 2007/08/30 07:18:23 ibadm Exp $ */
3 #ifndef __dblocks_h
4 #define __dblocks_h
5 
12 #include <mix/ErrCodes.h>
13 #include <mix/locks.h>
14 #include <ldb/dbtc.h>
15 
16 
19 #define DB_LOCK_TRIES 3
20 
23 #define DB_LOCK_MAX_DELAY 300000
24 
26 #define DB_LOCK_UNKNOWN_ID ((DbIndex)(-1))
27 
29 #define DB_LOCK_EXCL_FNAME_EXT ".exl"
30 
32 #define DB_LOCK_SHARED_FNAME_EXT ".lac"
33 
35 #define DB_LOCK_READ_ONLY "ro"
36 
38 #define DB_LOCK_READ_WRITE "rw"
39 
40 
42 typedef struct
43 {
44  LockId id;
46  char type[3];
48  char moment[MOMENT_LEN+1];
49  char appname[WE_NAME_LEN+1];
50  char owner[WE_NAME_LEN+1];
51  char workplace[WE_NAME_LEN+1];
52  char host[WE_NAME_LEN+1];
53  pid_t pid;
54 
55 } DbLockDescr;
56 
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif /* __cplusplus */
61 
62 
66 ErrCode LockDbResource (LockId* plid, const char* project,
67  const dbNameStruct* dbns, DbAccess dbac);
68 
72 ErrCode LockDbResourceByName (LockId* plid, const char* project,
73  const char* dbname, DbAccess dbac);
74 
81 ErrCode RelockDbResource (LockId lid, const char* project,
82  const dbNameStruct* dbns, DbAccess new_dbac);
83 
90 ErrCode RelockDbResourceByName (LockId lid, const char* project,
91  const char* dbname, DbAccess new_dbac);
92 
101 ErrCode CheckLockedDbResource (const char* project,
102  const dbNameStruct* dbns,
103  unsigned* ndescr,
104  DbLockDescr** ldescr);
105 
113 ErrCode ReleaseLockOfDbResource (const char* project,
114  const dbNameStruct* dbns,
115  LockId lid);
116 
124 ErrCode ReleaseDbResource (const char* project,
125  const dbNameStruct* dbns);
126 
127 
128 #ifdef __cplusplus
129 };
130 #endif /* __cplusplus */
131 
132 #endif /* dblocks.h */
Definition: dbnamedefs.h:67
Definition: dblocks.h:42
ErrCode CheckLockedDbResource(const char *project, const dbNameStruct *dbns, unsigned *ndescr, DbLockDescr **ldescr)
ErrCode RelockDbResource(LockId lid, const char *project, const dbNameStruct *dbns, DbAccess new_dbac)
ErrCode RelockDbResourceByName(LockId lid, const char *project, const char *dbname, DbAccess new_dbac)
ErrCode ReleaseLockOfDbResource(const char *project, const dbNameStruct *dbns, LockId lid)
LockId id
Definition: dblocks.h:44
ErrCode ReleaseDbResource(const char *project, const dbNameStruct *dbns)
ErrCode LockDbResourceByName(LockId *plid, const char *project, const char *dbname, DbAccess dbac)
ErrCode LockDbResource(LockId *plid, const char *project, const dbNameStruct *dbns, DbAccess dbac)