globus_scheduler_event_generator  5.6
 All Enumerations Enumerator Modules Pages
globus_scheduler_event_generator.h
1 /*
2  * Copyright 1999-2014 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GLOBUS_SCHEDULER_EVENT_GENERATOR_H
18 #define GLOBUS_SCHEDULER_EVENT_GENERATOR_H
19 
20 #include "globus_common.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 typedef enum
30 {
43 }
45 
46 #if __STDC_VERSION__ == 199901L
47 # define MYNAME __func__
48 #elif defined(__GNUC__)
49 # define MYNAME __FUNCTION__
50 #else
51 # define MYNAME ""
52 #endif
53 
54 typedef void (*globus_scheduler_event_generator_fault_t)(
55  void * user_arg,
56  globus_result_t fault);
57 
58 #define GLOBUS_SEG_ERROR_NULL_OBJECT() \
59  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
60  NULL, \
61  GLOBUS_SEG_ERROR_TYPE_NULL, \
62  __FILE__, \
63  MYNAME, \
64  __LINE__, \
65  "Null parameter")
66 
67 #define GLOBUS_SEG_ERROR_ALREADY_SET_OBJECT() \
68  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
69  NULL, \
70  GLOBUS_SEG_ERROR_TYPE_ALREADY_SET, \
71  __FILE__, \
72  MYNAME, \
73  __LINE__, \
74  "Value already set")
75 
76 #define GLOBUS_SEG_ERROR_INVALID_MODULE_OBJECT(module, errmsg) \
77  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
78  NULL, \
79  GLOBUS_SEG_ERROR_TYPE_INVALID_MODULE, \
80  __FILE__, \
81  MYNAME, \
82  __LINE__, \
83  "Invalid module %s: %s", \
84  module, \
85  errmsg)
86 
87 #define GLOBUS_SEG_ERROR_INVALID_FORMAT_OBJECT(fmt) \
88  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
89  NULL, \
90  GLOBUS_SEG_ERROR_TYPE_INVALID_FORMAT, \
91  __FILE__, \
92  MYNAME, \
93  __LINE__, \
94  "Invalid format %s", \
95  fmt)
96 
97 #define GLOBUS_SEG_ERROR_OUT_OF_MEMORY_OBJECT() \
98  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
99  NULL, \
100  GLOBUS_SEG_ERROR_TYPE_OUT_OF_MEMORY, \
101  __FILE__, \
102  MYNAME, \
103  __LINE__, \
104  "Out of memory")
105 
106 #define GLOBUS_SEG_ERROR_LOADING_MODULE_OBJECT(module, dlerr_msg) \
107  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
108  NULL, \
109  GLOBUS_SEG_ERROR_TYPE_LOADING_MODULE, \
110  __FILE__, \
111  MYNAME, \
112  __LINE__, \
113  "Unable to dlopen module \"%s\": %s", \
114  module, \
115  dlerr_msg)
116 
117 #define GLOBUS_SEG_ERROR_NULL \
118  globus_error_put(GLOBUS_SEG_ERROR_NULL_OBJECT())
119 
120 #define GLOBUS_SEG_ERROR_ALREADY_SET \
121  globus_error_put(GLOBUS_SEG_ERROR_ALREADY_SET_OBJECT())
122 
123 #define GLOBUS_SEG_ERROR_INVALID_MODULE(module, errmsg) \
124  globus_error_put(GLOBUS_SEG_ERROR_INVALID_MODULE_OBJECT(module, errmsg))
125 
126 #define GLOBUS_SEG_ERROR_INVALID_FORMAT(fmt) \
127  globus_error_put(GLOBUS_SEG_ERROR_INVALID_FORMAT_OBJECT(fmt))
128 
129 #define GLOBUS_SEG_ERROR_OUT_OF_MEMORY \
130  globus_error_put(GLOBUS_SEG_ERROR_OUT_OF_MEMORY_OBJECT())
131 
132 #define GLOBUS_SEG_ERROR_LOADING_MODULE(module, dlerr_msg) \
133  globus_error_put(GLOBUS_SEG_ERROR_LOADING_MODULE_OBJECT(module, \
134  dlerr_msg))
135 
136 extern globus_module_descriptor_t globus_i_scheduler_event_generator_module;
137 #define GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE \
138  (&globus_i_scheduler_event_generator_module)
139 
158 globus_result_t
159 globus_scheduler_event(
160  const char * format,
161  ...);
162 
163 globus_result_t
164 globus_scheduler_event_pending(
165  time_t timestamp,
166  const char * jobid);
167 
168 globus_result_t
169 globus_scheduler_event_active(
170  time_t timestamp,
171  const char * jobid);
172 
173 globus_result_t
174 globus_scheduler_event_failed(
175  time_t timestamp,
176  const char * jobid,
177  int failure_code);
178 
179 globus_result_t
180 globus_scheduler_event_done(
181  time_t timestamp,
182  const char * jobid,
183  int exit_code);
184 
185 globus_result_t
186 globus_scheduler_event_generator_get_timestamp(
187  time_t * timestamp);
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif /* GLOBUS_SCHEDULER_EVENT_GENERATOR_H */
Definition: globus_scheduler_event_generator.h:42
Definition: globus_scheduler_event_generator.h:34
Definition: globus_scheduler_event_generator.h:32
Definition: globus_scheduler_event_generator.h:36
Definition: globus_scheduler_event_generator.h:40
globus_scheduler_event_generator_error_t
Definition: globus_scheduler_event_generator.h:29
Definition: globus_scheduler_event_generator.h:38