apr_jobs_manager.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
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 
21 /*
22  * apr_jobs_manager.h
23  *
24  * Created on: 19 May 2015
25  * Author: tyrrells
26  */
27 
28 #ifndef APR_JOBS_MANAGER_H_
29 #define APR_JOBS_MANAGER_H_
30 
31 #include "apr_global_storage.h"
32 #include "mod_grassroots_config.h"
33 #include "httpd.h"
34 
35 
36 
37 
38 /*
39  * The following preprocessor macros allow us to declare
40  * and define the variables in the same place. By default,
41  * they will expand to
42  *
43  * extern const char *SERVICE_NAME_S;
44  *
45  * however if ALLOCATE_JSON_TAGS is defined then it will
46  * become
47  *
48  * const char *SERVICE_NAME_S = "path";
49  *
50  * ALLOCATE_RESOURCE_TAGS must be defined only once prior to
51  * including this header file. Currently this happens in
52  * resource.c.
53  */
54 
55 #ifndef DOXYGEN_SHOULD_SKIP_THIS
56 
57 #ifdef ALLOCATE_APR_JOBS_MANAGER_TAGS
58  #define APR_JOBS_MANAGER_PREFIX
59  #define APR_JOBS_MANAGER_VAL(x) = x
60 #else
61  #define APR_JOBS_MANAGER_PREFIX extern
62  #define APR_JOBS_MANAGER_VAL(x)
63 #endif
64 
65 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
66 
67 
74 APR_JOBS_MANAGER_PREFIX const char *APR_JOBS_MANAGER_CACHE_ID_S APR_JOBS_MANAGER_VAL("grassroots-jobs-socache");
75 
76 
77 #ifdef __cplusplus
78 extern "C"
79 {
80 #endif
81 
91 APRJobsManager *InitAPRJobsManager (server_rec *server_p, apr_pool_t *pool_p, const char *provider_name_s);
92 
93 
105 APRJobsManager *APRJobsManagerChildInit (apr_pool_t *pool_p, server_rec *server_p);
106 
107 
118 apr_status_t CleanUpAPRJobsManager (void *value_p);
119 
120 
132 bool PostConfigAPRJobsManager (APRJobsManager *manager_p, apr_pool_t *config_pool_p, server_rec *server_p, const char *provider_name_s);
133 
134 
143 bool APRJobsManagerPreConfigure (APRJobsManager *manager_p, apr_pool_t *config_pool_p);
144 
154 void APRServiceJobFinished (JobsManager *jobs_manager_p, uuid_t job_key);
155 
156 
165 bool DestroyAPRJobsManager (APRJobsManager *jobs_manager_p);
166 
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* APR_JOBS_MANAGER_H_ */
APRJobsManager * APRJobsManagerChildInit(apr_pool_t *pool_p, server_rec *server_p)
Adjust an APRJobsManager for when an httpd child process is started.
bool PostConfigAPRJobsManager(APRJobsManager *manager_p, apr_pool_t *config_pool_p, server_rec *server_p, const char *provider_name_s)
Configure an APRJobsManager in the Apache parent process before any child processes are launched.
This datatype is used by the Apache HTTPD server to be the Grassroots JobsManager.
Definition: mod_grassroots_config.h:51
bool DestroyAPRJobsManager(APRJobsManager *jobs_manager_p)
Free an APRJobsManager.
A datatype for monitoring ServiceJobs.
Definition: jobs_manager.h:99
bool APRJobsManagerPreConfigure(APRJobsManager *manager_p, apr_pool_t *config_pool_p)
Set up an APRJobsManager prior to the configuration details being used.
APRJobsManager * InitAPRJobsManager(server_rec *server_p, apr_pool_t *pool_p, const char *provider_name_s)
Get the JobsManager to use in the Grassroots module.
apr_status_t CleanUpAPRJobsManager(void *value_p)
Release any resources that an APRJobsManager.
void APRServiceJobFinished(JobsManager *jobs_manager_p, uuid_t job_key)
Notify that a ServiceJob with a given UUID has finished and can be removed from the given JobsManager...
const char * APR_JOBS_MANAGER_CACHE_ID_S
The identifier for the named shared object cache to use for sharing ServiceJobs between different htt...
Definition: apr_jobs_manager.h:74