1 /***************************************************************************
3 * Copyright (C) Lakshya Solutions Ltd. All rights reserved. *
5 ***************************************************************************/
30 //All the members of the configuration file
31 char logFile
[MAX_FILE_PATH_LEN
];
32 char dbFile
[MAX_FILE_PATH_LEN
];
33 char tableConfigFile
[MAX_FILE_PATH_LEN
];
34 char dsConfigFile
[MAX_FILE_PATH_LEN
];// DSN Config file
35 char stderrFile
[MAX_FILE_PATH_LEN
];
36 char replConfigFile
[MAX_FILE_PATH_LEN
];
37 char conflResoFile
[MAX_FILE_PATH_LEN
];
65 char dsn
[IDENTIFIER_LENGTH
];
70 int nwResponseTimeout
;
82 strcpy(logFile
, "/tmp/log/log.out");
83 strcpy(dbFile
, "/tmp/csql/db");
84 strcpy(tableConfigFile
, "/tmp/csql/csqltable.conf");
85 strcpy(dsConfigFile
,"/tmp/csql/csqlds.conf"); // DSN Config file
86 strcpy(stderrFile
, "stderr");
87 strcpy(replConfigFile
, "/tmp/csql/csqlnw.conf");
88 strcpy(conflResoFile
, "/tmp/csql/ConflResoFile.txt");
92 isCsqlSqlServer
= false;
95 isReplication
= false;
100 maxSysSize
= 10485760;
101 maxDbSize
= 104857600;
116 strcpy(dsn
,"myodbc3");
125 asyncMsgMax
= 8192; //default for linux
136 int readLine(FILE *fp
, char * buffer
);
137 int storeKeyVal(char *key
, char *val
);
138 int validateValues();
141 Config() { isLoaded
= false; }
142 int readAllValues(char *filename
);
145 inline int getPageSize() { return cVal
.pageSize
; }
146 inline int getMaxProcs() { return cVal
.maxProcs
; }
147 inline long getMaxSysDbSize() { return cVal
.maxSysSize
; }
148 inline long getMaxDbSize() { return cVal
.maxDbSize
; }
149 inline int getSysDbKey() { return cVal
.sysDbKey
; }
150 inline int getUserDbKey() { return cVal
.userDbKey
; }
151 inline bool useMmap() { return cVal
.mmap
; }
152 inline char* getLogFile() { return cVal
.logFile
; }
153 inline char* getDbFile() { return cVal
.dbFile
; }
154 inline long getMapAddress() { return cVal
.mapAddr
; }
155 inline int getMutexSecs() { return cVal
.mutexSecs
; }
156 inline int getMutexUSecs() { return cVal
.mutexUSecs
; }
157 inline int getMutexRetries() { return cVal
.mutexRetries
; }
158 inline int getLockSecs() { return cVal
.lockSecs
; }
159 inline int getLockUSecs() { return cVal
.lockUSecs
; }
160 inline int getLockRetries() { return cVal
.lockRetries
; }
161 inline int getSiteID(){ return cVal
.siteID
;}
162 inline bool useCache() { return cVal
.isCache
; }
163 inline int getCacheMode() { return (int) cVal
.mode
; }
164 inline char* getDSN() { return cVal
.dsn
; }
165 inline char* getDsConfigFile() { return cVal
.dsConfigFile
; }
166 inline char* getTableConfigFile() { return cVal
.tableConfigFile
; }
167 inline char* getStderrFile() { return cVal
.stderrFile
; }
168 inline bool useReplication() { return cVal
.isReplication
; }
169 inline bool useDurability() { return cVal
.isDurable
; }
170 inline int getDurableMode() { return cVal
.durableMode
; }
171 inline bool useCsqlSqlServer() { return cVal
.isCsqlSqlServer
; }
172 inline int getPort() { return cVal
.port
; }
173 inline char* getReplConfigFile() { return cVal
.replConfigFile
; }
174 inline char* getConflResoFile() { return cVal
.conflResoFile
; }
175 inline long getMaxQueueLogs() { return cVal
.maxQueueLogs
; }
176 inline int getNoOfReplSites() { return cVal
.maxReplSites
; }
177 inline int getMsgKey() { return cVal
.msgKey
; }
178 inline int getAsyncMsgMax() { return cVal
.asyncMsgMax
; }
179 inline int getShmIDKey() { return cVal
.shmKeyForId
; }
180 inline int getNetworkResponseTimeout() { return cVal
.nwResponseTimeout
; }
181 inline int getNetworkConnectTimeout() { return cVal
.nwConnectTimeout
; }
182 inline bool useTwoWayCache() { return cVal
.isTwoWay
; }
183 inline int getCacheWaitSecs() { return cVal
.cacheWaitSecs
; }
184 inline int getLogLevel() { return cVal
.logLevel
; }
185 inline int getNoOfProcessors() { return cVal
.noOfProcessors
; }
191 static Config config
;
192 static Logger logger
;
199 char hostName
[IDENTIFIER_LENGTH
];
202 SiteInfoData() { siteId
= -1; port
= 0; hostName
[0]='\0'; mode
[0]='\0';};
208 DbRetVal
populateSiteInfoList();
213 bool isAsyncSitePresent();
214 bool isSyncSitePresent();
215 SiteInfo() { populateSiteInfoList(); }
217 List
& getSiteInfoList() { return siteInfoList
; }
218 List
& getSyncSiteInfoList() { return syncSiteList
; }
219 List
& getAsyncSiteInfoList() { return asyncSiteList
; }