📄 sscapi.h
字号:
/*************************************************************************\
** source * sscapi.h
**
** description * SOLID Accelerator Control API.
** *
** *
** * (C) Copyright Solid Information Technology Ltd 2000
\*************************************************************************/
#ifndef SSCAPI_H
#define SSCAPI_H
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#if defined(WIN32)
#define SSC_CALL __stdcall
#else
#define SSC_CALL /* no special calling convention */
#endif
/* API return codes */
typedef enum {
SSC_SUCCESS = 0,
SSC_ERROR = 1,
SSC_ABORT = 2,
SSC_FINISHED = 3,
SSC_CONT = 4,
SSC_CONNECTIONS_EXIST = 5,
SSC_UNFINISHED_TASKS = 6,
SSC_INVALID_HANDLE = 7,
SSC_INVALID_LICENSE = 8,
SSC_NODATABASEFILE = 9,
SSC_SERVER_NOTRUNNING = 10,
SSC_INFO_SERVER_RUNNING = 11,
SSC_SERVER_INNETCOPYMODE = 12,
SSC_CORRUPTED_DBFILE = 30,
SSC_CORRUPTED_LOGFILE = 31
} SscRetT;
/* Task priorities */
typedef enum {
SSC_PRIO_HIGH = 0,
SSC_PRIO_NORMAL,
SSC_PRIO_IDLE,
SSC_PRIO_DEFAULT
} SscTaskPrioT;
/* Notify function types */
typedef enum {
SSC_NOTIFY_SHUTDOWN = 0,
SSC_NOTIFY_SHUTDOWN_REQUEST,
SSC_NOTIFY_BACKUP_REQUEST,
SSC_NOTIFY_ROWSTOMERGE,
SSC_NOTIFY_MERGE_REQUEST,
SSC_NOTIFY_CHECKPOINT_REQUEST,
SSC_NOTIFY_IDLE,
SSC_NOTIFY_NETCOPY_REQUEST,
SSC_NOTIFY_NETCOPY_FINISHED,
SSC_NOTIFY_ENUMEND
} SscNotFunT;
/* Server status identifiers */
typedef enum {
SSC_STAT_NUM_WRITES_NOT_MERGED = 0,
SSC_STAT_NUM_SERVER_THREADS,
SSC_STAT_NUM_END
} SscStatusT;
/* Log types, for SSCLogHookAdd */
typedef enum {
SSC_LOG_UNDEFINED=0,
SSC_LOG_SOLMSG,
SSC_LOG_SOLERROR,
SSC_LOG_SOLTRACE,
SSC_LOG_SSDEBUG
} SscLogType;
/* Fatal error types, for SSCFatalErrorHookAdd */
typedef enum {
SSC_FATALERROR_UNDEFINED = 0, /* Should never happen. */
SSC_FATALERROR_ASSERT_EXIT, /* Assertion failure, exiting. */
SSC_FATALERROR_OUTOFMEMORY, /* Out of memory, trying to recover. */
SSC_FATALERROR_OUTOFMEMORY_EXIT, /* Out of error, exiting. */
SSC_FATALERROR_DISKERROR, /* Disk error, trying to recover. */
SSC_FATALERROR_DISKERROR_EXIT /* Disk error, exiting. */
} SscFatalErrorType;
typedef enum {
SSC_MEMALLOC_THREADLOCAL = 0, /* Use thread local memory allocator, user
must register and unregister threads to
avoid excessive memory leaks. This is
fastest method in multi-threaded
systems. */
SSC_MEMALLOC_GLOBAL, /* Use global memory context. */
SSC_MEMALLOC_SYSMEM /* Use system memory allocator directly.
This is slowest method but releases
memory back to other use. */
} SscMemoryAllocatorType;
/* LocalServer States: */
typedef long SscStateT;
/*
* set server open: state = state | SSC_STATE_OPEN;
* set server closed: state = state & ~SSC_STATE_OPEN;
* set prefetch on: state = state | SSC_STATE_PREFETCH;
* set prefetch off: state = state & ~SSC_STATE_PREFETCH;
*/
#define SSC_STATE_OPEN (1 << 0)
#define SSC_STATE_PREFETCH (1 << 1)
/* Task classes */
typedef long SscTaskSetT;
#define SSC_TASK_NONE (0)
#define SSC_TASK_CHECKPOINT (1 << 0)
#define SSC_TASK_BACKUP (1 << 1)
#define SSC_TASK_MERGE (1 << 2)
#define SSC_TASK_LOCALUSERS (1 << 3)
#define SSC_TASK_REMOTEUSERS (1 << 4)
#define SSC_TASK_SYNC_HISTCLEAN (1 << 5)
#define SSC_TASK_SYNC_MESSAGE (1 << 6)
#define SSC_TASK_HOTSTANDBY (1 << 7)
#define SSC_TASK_HOTSTANDBY_CATCHUP (1 << 8)
#define SSC_TASK_BACKGROUND (1 << 9)
#define SSC_TASK_ALL (SSC_TASK_CHECKPOINT | SSC_TASK_BACKUP | \
SSC_TASK_MERGE | SSC_TASK_LOCALUSERS | \
SSC_TASK_REMOTEUSERS | SSC_TASK_SYNC_HISTCLEAN | \
SSC_TASK_SYNC_MESSAGE | SSC_TASK_HOTSTANDBY | \
SSC_TASK_HOTSTANDBY_CATCHUP | SSC_TASK_BACKGROUND)
/* Server handle */
typedef struct ssc_serverhandle_st* ssc_serverhandle_t;
typedef ssc_serverhandle_t SscServerT;
/* Notifier function type */
typedef int (SSC_CALL *notify_fun)(
SscServerT h,
SscNotFunT what,
void* userdata);
/* Log hook function type */
typedef void (*SSCLogHookT)(SscLogType log_type,
const char* fmt, ...);
/* Fatal error hook function type */
typedef void (*SSCFatalErrorHookT)(SscFatalErrorType type);
/*********************************
* SOLID Accelerator Control API. *
*********************************/
/* Starts the server */
SscRetT SSC_CALL SSCStartServer(
int argc,
char* argv[],
SscServerT* h,
SscStateT runflags);
/* Starts the server */
SscRetT SSC_CALL SSCStartDisklessServer(
int argc,
char* argv[],
SscServerT* h,
SscStateT runflags,
char* lic_string,
char* ini_string);
/* Shutdown */
SscRetT SSC_CALL SSCStopServer(
SscServerT h,
int force);
/* Is server running */
int SSC_CALL SSCIsRunning(
SscServerT h);
/* Sets the state of the server */
SscRetT SSC_CALL SSCSetState(
SscServerT h,
SscStateT runflags);
/* Sets a notifier */
SscRetT SSC_CALL SSCSetNotifier(
SscServerT h,
SscNotFunT what,
notify_fun handler,
void* userdata);
/* Run active tasks */
SscRetT SSC_CALL SSCAdvanceTasks(
SscServerT h,
long timeout_ms);
/* Returns types of currently active tasks */
SscTaskSetT SSC_CALL SSCGetActiveTaskClass(
SscServerT h);
/* Returns types of currently suspended tasks */
SscTaskSetT SSC_CALL SSCGetSuspendedTaskClass(
SscServerT h);
/* Sets tasks to suspend state */
SscRetT SSC_CALL SSCSuspendTaskClass(
SscServerT h,
SscTaskSetT tasktype);
/* Resumes a task class */
SscRetT SSC_CALL SSCResumeTaskClass(
SscServerT h,
SscTaskSetT tasktype);
/* Sets task class priority */
SscRetT SSC_CALL SSCSetTaskClassPrio(
SscServerT h,
SscTaskSetT tasktype,
SscTaskPrioT prio);
/* Returns the priority of a given task class */
SscRetT SSC_CALL SSCGetTaskClassPrio(
SscServerT h,
SscTaskSetT tasktype,
SscTaskPrioT* prio);
/* Sets the connection priority */
SscRetT SSC_CALL SSCSetConnectionPrio(
SscServerT h,
int userid,
SscTaskPrioT prio);
/* Get the connection priority */
SscRetT SSC_CALL SSCGetConnectionPrio(
SscServerT h,
int userid,
SscTaskPrioT* p_prio);
/* Returns counter status */
SscRetT SSC_CALL SSCGetStatusNum(
SscServerT h,
SscStatusT stat,
long* num);
/* Runs merge */
SscRetT SSC_CALL SSCRunMerge(
SscServerT h,
long timeout_ms);
/* Returns non zero if this is really linked to the LocalServer */
int SSC_CALL SSCIsThisLocalServer(
void);
/* Registers a user thread */
SscRetT SSC_CALL SSCRegisterThread(
SscServerT h);
/* Unregisters a user thread */
SscRetT SSC_CALL SSCUnregisterThread(
SscServerT h);
/* Returns the server handle */
SscServerT SSC_CALL SSCGetServerHandle();
/* Sets logging hook, returns always SSC_SUCCESS */
SscRetT SSC_CALL SSCLogHookAdd(
SSCLogHookT hook);
/* Sets fatal error callback hook function, returns always SSC_SUCCESS.
Note that hook function is called deep inside server code so it
cannot call any Solid functions.
*/
SscRetT SSC_CALL SSCFatalErrorHookAdd(
SSCFatalErrorHookT hook);
/* Sets fatal error recovert resources. */
SscRetT SSC_CALL SSCFatalErrorInitRecovery(
int sparememsize);
/* Sets the memory allocator type. This must be done before
any other call to Solid functions. This is a global setting
and it cannot be changed after the first memory allocation
is done inside Solid functions.
*/
SscRetT SSC_CALL SSCSetMemoryAllocatorType(
SscMemoryAllocatorType type);
/* some utility functions */
int SSC_CALL SSCTaskClass2Str(
SscTaskSetT tasktype,
char** p_strtaskclass);
int SSC_CALL SSCStr2TaskClass(
char* strtaskclass,
SscTaskSetT* p_tasktype);
int SSC_CALL SSCPrio2Str(
SscTaskPrioT prio,
char** p_strprio);
int SSC_CALL SSCStr2Prio(
char* strprio,
SscTaskPrioT* p_prio);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif /* SSCAPI_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -