⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app.h

📁 extremeDB s sample code,useful for you
💻 H
字号:
/******************************************************************* *                                                                 * *  This file is a part of the eXtremeDB-HA Application Framework  * *  Copyright (c) 2001-2006 McObject LLC                           *  *  All Rights Reserved                                            * *                                                                 * *******************************************************************//** **************************************************************\n *                                                                \n  *\file  app.h                                                    \n *                                                                \n  *\brief    HA framework application definitions                  \n ******************************************************************//******************************************************************* *                                                                 *  * ATTENTION! The definitions of HA endpoints and connection       *  * parameters were made separately for each communication channel. * * You can find them in .H files included above.                   * *                                                                 * *******************************************************************/#ifndef	_PARAMS_H_  #define  _PARAMS_H_#ifdef __cplusplus  extern "C" { #endif#define INCLUDE_SOCKETS#include  "interface.h"/** *******************************************************************\n        definitions of database ***********************************************************************/#ifndef MCO_PLATFORM_X64#define DBSIZE	      ( 1024 * 1024 * 1 ) ///< Database size and page size #define DB_PAGESIZE   100                 ///< database page size#else#define DBSIZE	      ( 1024 * 1024 * 2 )#define DB_PAGESIZE   200#endif#define SHM_PAGESIZE  4096                ///< memory pagesize#define S1_RECORDS  1 //100               ///< Initial number of objects per class/** *****************************************************************\n        definitions of the application                               \n **********************************************************************/#define MAP_ADDRESS 0x20000000       ///< hint address - you may need to find your own#define COMMIT_WATCHDOG_TIME    4000 ///< watchdog time in  ms/** size of the asynchronous replication data buffer */#define ASYNC_DATABUF_SIZE      1024*1024#ifdef _DOC_  // for documentation/**  Define this if you wish to watch synchronous events */#define CFG_SYNCHRONOUS_EVENTS/**   Define this if you wish to watch asynchronous events */#define CFG_ASYNCHRONOUS_EVENTS/** Define this if you wish to perform asynchronous replication.   Comment this option if the asychronous replication is not defined   in mcocfg.h */#define CFG_ASYNCHRONOUS_REPLICATION#endif	//_DOC_/*    chooze the definitions described above *///#define CFG_SYNCHRONOUS_EVENTS//#define CFG_ASYNCHRONOUS_EVENTS#define CFG_ASYNCHRONOUS_REPLICATION#define HOST_MAX_NAMELENGTH    64     ///< max length of host name#define MAX_HA_INSTANCES       10     ///< max numer of HA instances#define MAX_REPLICAS           10     ///< max numer of replicas#define PRINT_REPORTS                 ///< define to output a detailed report#ifdef _WIN32_WCE  #define Printf printf#endif#if defined (_VXWORKS)  #define LOG_PATH 	"/tgtsvr/"#elif defined (_WIN32_WCE)  #define LOG_PATH 	""#else  #define LOG_PATH 	""#endifextern int test_ExitCode;#ifdef CFG_ASYNCHRONOUS_EVENTS#define NATHREADS 6 ///< number of asynchronous events threads/**\struct ThrParam_      Thread parameters */typedef struct  ThrParam_{  mco_db_h*   db;  int         finished;  THREAD_ID   tid;} ThrParam;/**\fn void threads(ThrParam *all_tp_ptr);  Description:\n  Creates threads for asynchronous events */void threads(ThrParam *all_tp_ptr);#endif //CFG_ASYNCHRONOUS_EVENTS/** counters */extern long ev_new_count;     ///< counter for "new" eventsextern long ev_update_count;  ///< counter for "update" eventsextern long ev_del_count;     ///< counter for "delete" events///< REPORT_COUNTER number of transactions in report#define   REPORT_COUNTER   1000/** Functions *//**\fn extern void async_events(ha_h ha);  Description:\n  Creation of asynchron events  */extern void async_events(ha_h ha);/**\fn ha_h  CreateDatabase( int instance);    Description:\n  Creation of the new database instance  */ha_h  CreateDatabase( int instance);  /**\fn ha_h  ConnectToDatabase( int instance);  Description:\n  connects to the existing database instance  */ha_h  ConnectToDatabase( int instance);/**\fn void  CloseDatabases(int flag);  Description:\n  closes all database instances */void  CloseDatabases(int flag);/**\fn ha_h CreateHAinstance(int instance);  Description:\n  creates HA instance */ha_h CreateHAinstance(int instance);/**\fn void InitHAinstance(ha_h ha, int instance);  Description:\n  initializes HA instance */void InitHAinstance(ha_h ha, int instance);/**\fn void InitHAthreads(ha_h ha);  Description:\n  creates threads for HA instance */void InitHAthreads(ha_h ha);/**\fn MCO_E_HA_REPLICA_STOP_REASON replication(ha_h ha);  Description:\n  performs replica's working loop */MCO_E_HA_REPLICA_STOP_REASON replication(ha_h ha);/**\fn void replica(ha_h ha);  Description:\n  performs replica's working loop */void replica(ha_h ha);/**\fn void master( int flag );  Description:\n  performs master's working loop */void master( int flag, ha_h ha );/**\fn void errhandler( int n );  Description:\n  error handler procedure */void errhandler( int n );/**\fn void ExitHandler(int flag);  Description:\n  provides emergency & normal exit from the program */void ExitHandler(int flag);/**\fn uint4 free_mem( mco_db_h db, int verbose);   returns amount of database's free memory */uint4 free_mem( mco_db_h db, int verbose);/**\fn void make_strings( void );  Description:\n  Makes dynamic text strings for database commit loop */void make_strings( void );/**\fn void replica_cancel();    cancels replica commit loop */void replica_cancel();/**\fn ReplicaReport();    reports replica results */void    ReplicaReport();/**\fn void  MasterReport();    reports master results */void  MasterReport();#ifdef __cplusplus  }#endif#endif  //_PARAMS_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -