00001
00004 #ifndef __DRMS_SERVER_H
00005 #define __DRMS_SERVER_H
00006
00007 #include "drms_types.h"
00008
00009
00010
00011
00012
00013 #ifdef __DRMS_SERVER_C
00014 char abortstring[1024];
00015 #else
00016 extern char abortstring[1024];
00017 #endif
00018
00019
00020 #define Exit(code) do { snprintf(abortstring,1023,"aborted: exit called in file %s, line %d",__FILE__,__LINE__); exit((code)); } while(0)
00021
00022
00023
00024 #define DRMS_LOG_DSNAME "drms_logs"
00025
00026 #define DRMS_LOG_RETENTION (10)
00027 #define DRMS_LOG_TAPEGROUP 1
00028
00029 #define WEEK_SECONDS (60*60*24*7)
00030
00031 #define DRMS_ABORT_SLEEP (2)
00032
00033 #define kExtTapegroupSlot (10000)
00034 #define kExtTapegroupMaxStoreset (1)
00035
00036
00037
00038 sem_t *drms_server_getsdsem(void);
00039
00040 void drms_server_initsdsem(void);
00041
00042 void drms_server_destroysdsem(void);
00043
00044 DRMS_Shutdown_State_t drms_server_getsd(void);
00045
00046 void drms_server_setsd(DRMS_Shutdown_State_t st);
00047
00048 int drms_server_registercleaner(DRMS_Env_t *env, CleanerData_t *data);
00049
00051 void *drms_server_thread(void *arg);
00053 void *drms_sums_thread(void *arg);
00055 void *drms_signal_thread(void *arg);
00056
00058 int drms_server_authenticate(int sockfd, DRMS_Env_t *env, int clientid);
00060 int drms_server_newslots(DRMS_Env_t *env, int sockfd);
00062 int drms_server_getunit(DRMS_Env_t *env, int sockfd);
00063
00072 int drms_server_getunits(DRMS_Env_t *env, int sockfd);
00074 int drms_server_newseries(DRMS_Env_t *env, int sockfd);
00076 int drms_server_dropseries(DRMS_Env_t *env, int sockfd);
00084 int drms_server_dropseries_su(DRMS_Env_t *env, const char *tn, DRMS_Array_t *vec);
00085 long long drms_server_gettmpguid(int *sockfd);
00086
00087 int drms_server_getsudir(DRMS_Env_t *env, int sockfd);
00088
00097 int drms_server_getsudirs(DRMS_Env_t *env, int sockfd);
00098
00099 int drms_server_getsuinfo(DRMS_Env_t *env, int sockfd);
00100
00101 int drms_server_getdbuser(DRMS_Env_t *env, int sockfd);
00102
00103 int drms_server_setretention(DRMS_Env_t *env, int sockfd);
00104
00105 int drms_server_session_setwrite(DRMS_Env_t *env, int sockfd);
00106
00108 int drms_server_alloc_recnum(DRMS_Env_t *env, int sockfd);
00110 void drms_server_transient_records(DRMS_Env_t *env, char *series, int n, long long *recnums);
00112 int drms_server_close_session(DRMS_Env_t *env, char *stat_str, int clients,
00113 int log_retention, int archive_log);
00115 int drms_server_open_session(DRMS_Env_t *env);
00117 void drms_server_abort(DRMS_Env_t *env, int final);
00119 void drms_server_commit(DRMS_Env_t *env, int final);
00121 int drms_server_slot_setstate(DRMS_Env_t *env, int sockfd);
00123 void drms_lock_server(DRMS_Env_t *env);
00125 void drms_unlock_server(DRMS_Env_t *env);
00127 int drms_trylock_server(DRMS_Env_t *env);
00132 int drms_server_begin_transaction(DRMS_Env_t *env);
00141 void drms_server_end_transaction(DRMS_Env_t *env, int abort, int final);
00142
00143 int drms_session_setread(DRMS_Env_t *env);
00144 int drms_session_setwrite(DRMS_Env_t *env);
00145
00146 #endif