globus_scheduler_event_generator.h

00001 /*
00002  * Copyright 1999-2014 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef GLOBUS_SCHEDULER_EVENT_GENERATOR_H
00018 #define GLOBUS_SCHEDULER_EVENT_GENERATOR_H
00019 
00020 #include "globus_common.h"
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
00027 
00031 #endif
00032 
00048 typedef enum
00049 {
00051     GLOBUS_SEG_ERROR_TYPE_NULL = 1024,
00053     GLOBUS_SEG_ERROR_TYPE_ALREADY_SET,
00055     GLOBUS_SEG_ERROR_TYPE_INVALID_MODULE,
00057     GLOBUS_SEG_ERROR_TYPE_INVALID_FORMAT,
00059     GLOBUS_SEG_ERROR_TYPE_OUT_OF_MEMORY,
00061     GLOBUS_SEG_ERROR_TYPE_LOADING_MODULE
00062 }
00063 globus_scheduler_event_generator_error_t;
00064 
00065 #if __STDC_VERSION__ == 199901L
00066 #    define MYNAME __func__
00067 #elif defined(__GNUC__)
00068 #    define MYNAME __FUNCTION__
00069 #else
00070 #    define MYNAME ""
00071 #endif
00072 
00073 typedef void (*globus_scheduler_event_generator_fault_t)(
00074     void *                              user_arg,
00075     globus_result_t                     fault);
00076 
00077 #define GLOBUS_SEG_ERROR_NULL_OBJECT() \
00078     globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
00079             NULL, \
00080             GLOBUS_SEG_ERROR_TYPE_NULL, \
00081             __FILE__, \
00082             MYNAME, \
00083             __LINE__, \
00084             "Null parameter")
00085 
00086 #define GLOBUS_SEG_ERROR_ALREADY_SET_OBJECT() \
00087     globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
00088             NULL, \
00089             GLOBUS_SEG_ERROR_TYPE_ALREADY_SET, \
00090             __FILE__, \
00091             MYNAME, \
00092             __LINE__, \
00093             "Value already set")
00094     
00095 #define GLOBUS_SEG_ERROR_INVALID_MODULE_OBJECT(module, errmsg) \
00096     globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
00097             NULL, \
00098             GLOBUS_SEG_ERROR_TYPE_INVALID_MODULE, \
00099             __FILE__, \
00100             MYNAME, \
00101             __LINE__, \
00102             "Invalid module %s: %s", \
00103             module, \
00104             errmsg)
00105 
00106 #define GLOBUS_SEG_ERROR_INVALID_FORMAT_OBJECT(fmt) \
00107     globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
00108             NULL, \
00109             GLOBUS_SEG_ERROR_TYPE_INVALID_FORMAT, \
00110             __FILE__, \
00111             MYNAME, \
00112             __LINE__, \
00113             "Invalid format %s", \
00114             fmt)
00115 
00116 #define GLOBUS_SEG_ERROR_OUT_OF_MEMORY_OBJECT() \
00117     globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
00118             NULL, \
00119             GLOBUS_SEG_ERROR_TYPE_OUT_OF_MEMORY, \
00120             __FILE__, \
00121             MYNAME, \
00122             __LINE__, \
00123             "Out of memory")
00124 
00125 #define GLOBUS_SEG_ERROR_LOADING_MODULE_OBJECT(module, dlerr_msg) \
00126     globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
00127             NULL, \
00128             GLOBUS_SEG_ERROR_TYPE_LOADING_MODULE, \
00129             __FILE__, \
00130             MYNAME, \
00131             __LINE__, \
00132             "Unable to dlopen module \"%s\": %s", \
00133             module, \
00134             dlerr_msg)
00135 
00136 #define GLOBUS_SEG_ERROR_NULL \
00137     globus_error_put(GLOBUS_SEG_ERROR_NULL_OBJECT())
00138 
00139 #define GLOBUS_SEG_ERROR_ALREADY_SET \
00140     globus_error_put(GLOBUS_SEG_ERROR_ALREADY_SET_OBJECT())
00141 
00142 #define GLOBUS_SEG_ERROR_INVALID_MODULE(module, errmsg) \
00143     globus_error_put(GLOBUS_SEG_ERROR_INVALID_MODULE_OBJECT(module, errmsg))
00144 
00145 #define GLOBUS_SEG_ERROR_INVALID_FORMAT(fmt) \
00146     globus_error_put(GLOBUS_SEG_ERROR_INVALID_FORMAT_OBJECT(fmt))
00147 
00148 #define GLOBUS_SEG_ERROR_OUT_OF_MEMORY \
00149     globus_error_put(GLOBUS_SEG_ERROR_OUT_OF_MEMORY_OBJECT())
00150 
00151 #define GLOBUS_SEG_ERROR_LOADING_MODULE(module, dlerr_msg) \
00152     globus_error_put(GLOBUS_SEG_ERROR_LOADING_MODULE_OBJECT(module, \
00153             dlerr_msg))
00154 
00155 extern globus_module_descriptor_t globus_i_scheduler_event_generator_module;
00156 #define GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE \
00157     (&globus_i_scheduler_event_generator_module)
00158 
00178 globus_result_t
00179 globus_scheduler_event(
00180     const char * format,
00181     ...);
00182 
00183 globus_result_t
00184 globus_scheduler_event_pending(
00185     time_t                              timestamp,
00186     const char *                        jobid);
00187 
00188 globus_result_t
00189 globus_scheduler_event_active(
00190     time_t                              timestamp,
00191     const char *                        jobid);
00192 
00193 globus_result_t
00194 globus_scheduler_event_failed(
00195     time_t                              timestamp,
00196     const char *                        jobid,
00197     int                                 failure_code);
00198 
00199 globus_result_t
00200 globus_scheduler_event_done(
00201     time_t                              timestamp,
00202     const char *                        jobid,
00203     int                                 exit_code);
00204 
00205 globus_result_t
00206 globus_scheduler_event_generator_get_timestamp(
00207     time_t *                            timestamp);
00208 
00209 #ifdef __cplusplus
00210 }
00211 #endif
00212 
00213 #endif /* GLOBUS_SCHEDULER_EVENT_GENERATOR_H */

Generated on 5 Sep 2016 for globus_scheduler_event_generator by  doxygen 1.4.7