📄 mco.h
字号:
MCO_RET mco_class_stat_get( mco_trans_h t, uint2 class_code, /*OUT*/ mco_class_stat_h stat ); /* unrecoverable error handler */typedef void ( * mco_error_handler_f ) (int errcode);void mco_error_set_handler( mco_error_handler_f f );/* depending on configuration, extended information (file, line) may be available *//* if both handlers are defined, extended is called first */typedef void ( * mco_error_handler_f_ex ) (int errcode, const char * file, int line);void mco_error_set_handler_ex( mco_error_handler_f_ex f );/* Heap memory manager */#ifdef MCO_NO_FORWARDStypedef void * mco_heap_h;#elsestruct mco_heap_head_t_; /* heap header */typedef struct mco_heap_head_t_ * mco_heap_h;#endifint mco_heap_head_size(void); /* size in bytes required by heap header */void mco_heap_init ( void * memoryptr, uint4 heapsize /* 2 ** N */ , /*INOUT*/ mco_heap_h h, /* caller must allocate heap head */ char *name );void mco_heap_destroy ( mco_heap_h h); /* releasing semaphore */uint4 mco_heap_freesize ( mco_heap_h h); /* free bytes estimated */uint4 mco_heap_usedsize ( mco_heap_h h); /* used bytes estimated */void * mco_malloc ( mco_heap_h h, uint4 nbt); void * mco_calloc ( mco_heap_h h, uint4 num, uint4 siz); void mco_free ( mco_heap_h h, void * p); void * mco_realloc ( mco_heap_h h, void * p, uint4 newsize);/* save/restore *//* abstract write and read streams interfaces; stream handle is a pointer to implementation-specific data */typedef int (*mco_stream_write)( void *stream_handle, const void * from, unsigned nbytes);typedef int (*mco_stream_read) ( void *stream_handle, /*OUT*/ void * to, unsigned max_nbytes);/* save db content to output stream */MCO_RET mco_db_save( void * stream_handle, mco_stream_write output_stream_writer, mco_db_h db);/* create db instance and load content from input stream - instead of mco_db_open() */MCO_RET mco_db_load( void * stream_handle, mco_stream_read input_stream_reader, const char * db_name, mco_dictionary_h dict, void * mem_ptr, mco_puint total_size);/* multi-segment memory variant of mco_db_load */MCO_RET mco_db_load_ms( void * stream_handle, mco_stream_read input_stream_reader, const char * db_name, mco_dictionary_h dict, uint2 n_segments, void * const * mem_segments, /* vector[n_segments] of pointers to memory segments */ const mco_puint * segment_sizes); /* vector[n_segments] of sizes of memory segments *//* event handling *//* synchronous events: */ typedef enum MCO_EVENT_TYPE_E_ { MCO_EVENT_NEW, MCO_EVENT_UPDATE, MCO_EVENT_DELETE, MCO_EVENT_DELETE_ALL} MCO_EVENT_TYPE; typedef enum MCO_HANDLING_ORDER_E_ { MCO_BEFORE_UPDATE, MCO_AFTER_UPDATE} MCO_HANDLING_ORDER; /* asynchronous events, handlers in different threads are signaled after commit: */MCO_RET mco_async_event_wait( mco_db_h dbh, int event_id);MCO_RET mco_async_event_release( mco_db_h dbh, int event_id);MCO_RET mco_async_event_release_all( mco_db_h dbh);/* boolean type */typedef int mco_bool;#define MCO_YES 1#define MCO_NO 0typedef struct mco_runtime_info_t_{ uint1 mco_version_major; uint1 mco_version_minor; uint2 mco_build_number; /* Core configuration parameters: */ uint1 mco_checklevel; uint1 mco_multithreaded; uint1 mco_shm_supported; uint1 mco_fixedrec_supported; uint1 mco_xml_supported; uint1 mco_stat_supported; uint1 mco_events_supported; uint1 mco_versioning_supported; uint1 mco_save_load_supported; uint1 mco_synch_native_supported; uint1 mco_evaluation_version; uint1 mco_recovery_supported; /* unicode */ uint1 mco_unicode_supported; uint1 mco_wchar_supported; /* RTL*/ uint1 mco_rtl_supported; // true is C runtime is linked-in /* LOG */ uint1 mco_log_supported; /* SQL */ uint1 mco_sql_supported; /* HA- related configuration */ uint1 mco_ha_supported; uint1 mco_asynch_replication_supported; uint1 mco_hotsynch_supported; uint1 mco_2phasecommit_supported; uint1 mco_reserved1; uint2 mco_reserved2;}mco_runtime_info_t;/* obtain eXtremeDB runtime configuration info: */void mco_get_runtime_info( /*OUT*/ mco_runtime_info_t * pinf);#define MCO_REPORT_OID 1#define MCO_REPORT_LIST 2#define MCO_REPORT_TREE 4#define MCO_REPORT_HASH 8#define MCO_REPORT_LIST_TOTAL 16#define MCO_REPORT_TREE_TOTAL 32#define MCO_REPORT_HASH_TOTAL 64#define MCO_REPORT_DB_TOTAL 128#define MCO_REPORT_AUTO_OID 256#define MCO_REPORT_DB_ALL 511typedef struct mco_report_item_t_{ uint4 flag; /* one of MCO_REPORT_... */ uint4 id; #if defined(MCO_PLATFORM_X64) && defined(MCO_LONG_OBJECTS) mco_puint objects_num;#else //MCO_PLATFORM_X64_MCO_LONG_OBJECTS uint4 objects_num;#endif //MCO_PLATFORM_X64_MCO_LONG_OBJECTS mco_puint used_pages; uint2 tree_height; const char * name; /* only in debug mode */} mco_report_item_t,* mco_report_item_h;MCO_RET mco_db_report( mco_db_h db, uint4 flags, /* mask of MCO_REPORT_... */ /*OUT*/ mco_report_item_h items, int max_items, /*OUT*/ int * num_items /* returns num of filled items */ );typedef struct mco_dbconnection_param_t_{ uint4 task_id; void * user_data; int (* check_task_is_alive) (uint4 task_id, void *user_data); int flags; /* MCO_CONN_F_... */}mco_dbconnection_param_t;MCO_RET mco_db_connect_rs( const char * dbname, const mco_dbconnection_param_t * params, /*OUT*/ mco_db_h * pdb );MCO_RET mco_db_check_connections( mco_db_h db ); /* explicit call to clean dead connections *//* checks database resources and recovers if needed. The function is called from the separate thread by the amount of time.*/int mco_db_check_resources( const char * dbname, // database name mco_db_h * pdb, // datavase handler int loopcountm, // watch loop counter (optional) unsigned * wdt_state // pointer to local watchdog state flags );/* Connects to the database, checks and recovers the database unconditionally*/MCO_RET mco_db_connect_and_recover ( const char * dbname, mco_db_h * pdb, const mco_dbconnection_param_t *params );/* changing global options, per process */void mco_runtime_setoption(int option, int value);int mco_runtime_getoption(int option);#define MCO_RT_OPTION_RESERVED 20#define MCO_RT_OPTION_MUTEX_N0 21#define MCO_RT_OPTION_MUTEX_N2 22#define MCO_RT_OPTION_MUTEX_T0 23#define MCO_RT_OPTION_ZMUTEX_T0 24#define MCO_RT_OPTION_ZMUTEX_NR1 25#define MCO_RT_OPTION_LAST 26typedef long timer_unit; // what is it, does not matter, just timers, // timeouts, stream parameters are measured in the same units.#define MCO_TM_INFINITE ((timer_unit)-1)timer_unit mco_system_get_current_time();#ifdef __cplusplus }#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -