Grid Community Toolkit  6.2.1541705016
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 
26 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
27 
31 #endif
32 
48 typedef enum
49 {
62 }
64 
65 #if __STDC_VERSION__ == 199901L
66 # define MYNAME __func__
67 #elif defined(__GNUC__)
68 # define MYNAME __FUNCTION__
69 #else
70 # define MYNAME ""
71 #endif
72 
73 typedef void (*globus_scheduler_event_generator_fault_t)(
74  void * user_arg,
75  globus_result_t fault);
76 
77 #define GLOBUS_SEG_ERROR_NULL_OBJECT() \
78  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
79  NULL, \
80  GLOBUS_SEG_ERROR_TYPE_NULL, \
81  __FILE__, \
82  MYNAME, \
83  __LINE__, \
84  "Null parameter")
85 
86 #define GLOBUS_SEG_ERROR_ALREADY_SET_OBJECT() \
87  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
88  NULL, \
89  GLOBUS_SEG_ERROR_TYPE_ALREADY_SET, \
90  __FILE__, \
91  MYNAME, \
92  __LINE__, \
93  "Value already set")
94 
95 #define GLOBUS_SEG_ERROR_INVALID_MODULE_OBJECT(module, errmsg) \
96  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
97  NULL, \
98  GLOBUS_SEG_ERROR_TYPE_INVALID_MODULE, \
99  __FILE__, \
100  MYNAME, \
101  __LINE__, \
102  "Invalid module %s: %s", \
103  module, \
104  errmsg)
105 
106 #define GLOBUS_SEG_ERROR_INVALID_FORMAT_OBJECT(fmt) \
107  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
108  NULL, \
109  GLOBUS_SEG_ERROR_TYPE_INVALID_FORMAT, \
110  __FILE__, \
111  MYNAME, \
112  __LINE__, \
113  "Invalid format %s", \
114  fmt)
115 
116 #define GLOBUS_SEG_ERROR_OUT_OF_MEMORY_OBJECT() \
117  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
118  NULL, \
119  GLOBUS_SEG_ERROR_TYPE_OUT_OF_MEMORY, \
120  __FILE__, \
121  MYNAME, \
122  __LINE__, \
123  "Out of memory")
124 
125 #define GLOBUS_SEG_ERROR_LOADING_MODULE_OBJECT(module, dlerr_msg) \
126  globus_error_construct_error(GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE, \
127  NULL, \
128  GLOBUS_SEG_ERROR_TYPE_LOADING_MODULE, \
129  __FILE__, \
130  MYNAME, \
131  __LINE__, \
132  "Unable to dlopen module \"%s\": %s", \
133  module, \
134  dlerr_msg)
135 
136 #define GLOBUS_SEG_ERROR_NULL \
137  globus_error_put(GLOBUS_SEG_ERROR_NULL_OBJECT())
138 
139 #define GLOBUS_SEG_ERROR_ALREADY_SET \
140  globus_error_put(GLOBUS_SEG_ERROR_ALREADY_SET_OBJECT())
141 
142 #define GLOBUS_SEG_ERROR_INVALID_MODULE(module, errmsg) \
143  globus_error_put(GLOBUS_SEG_ERROR_INVALID_MODULE_OBJECT(module, errmsg))
144 
145 #define GLOBUS_SEG_ERROR_INVALID_FORMAT(fmt) \
146  globus_error_put(GLOBUS_SEG_ERROR_INVALID_FORMAT_OBJECT(fmt))
147 
148 #define GLOBUS_SEG_ERROR_OUT_OF_MEMORY \
149  globus_error_put(GLOBUS_SEG_ERROR_OUT_OF_MEMORY_OBJECT())
150 
151 #define GLOBUS_SEG_ERROR_LOADING_MODULE(module, dlerr_msg) \
152  globus_error_put(GLOBUS_SEG_ERROR_LOADING_MODULE_OBJECT(module, \
153  dlerr_msg))
154 
155 extern globus_module_descriptor_t globus_i_scheduler_event_generator_module;
156 #define GLOBUS_SCHEDULER_EVENT_GENERATOR_MODULE \
157  (&globus_i_scheduler_event_generator_module)
158 
179 globus_scheduler_event(
180  const char * format,
181  ...);
182 
184 globus_scheduler_event_pending(
185  time_t timestamp,
186  const char * jobid);
187 
189 globus_scheduler_event_active(
190  time_t timestamp,
191  const char * jobid);
192 
194 globus_scheduler_event_failed(
195  time_t timestamp,
196  const char * jobid,
197  int failure_code);
198 
200 globus_scheduler_event_done(
201  time_t timestamp,
202  const char * jobid,
203  int exit_code);
204 
206 globus_scheduler_event_generator_get_timestamp(
207  time_t * timestamp);
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif /* GLOBUS_SCHEDULER_EVENT_GENERATOR_H */
Definition: globus_scheduler_event_generator.h:61
Definition: globus_scheduler_event_generator.h:53
Definition: globus_scheduler_event_generator.h:51
Definition: globus_scheduler_event_generator.h:55
Definition: globus_scheduler_event_generator.h:59
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
globus_scheduler_event_generator_error_t
Definition: globus_scheduler_event_generator.h:48
Definition: globus_scheduler_event_generator.h:57
Module Descriptor.
Definition: globus_module.h:69