Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
remote_service_job.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 
22 /*
23  * remote_service_job.h
24  *
25  * Created on: 14 Feb 2016
26  * Author: billy
27  */
28 
29 #ifndef SERVICES_LIB_INCLUDE_REMOTE_SERVICE_JOB_H_
30 #define SERVICES_LIB_INCLUDE_REMOTE_SERVICE_JOB_H_
31 
32 #include "jansson.h"
33 
34 #include "service_job.h"
36 
37 
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 
40 #ifdef ALLOCATE_REMOTE_SERVICE_JOB_TAGS
41  #define REMOTE_SERVICE_JOB_PREFIX GRASSROOTS_SERVICE_API
42  #define REMOTE_SERVICE_JOB_VAL(x) = x
43 #else
44  #define REMOTE_SERVICE_JOB_PREFIX extern GRASSROOTS_SERVICE_API
45  #define REMOTE_SERVICE_JOB_VAL(x)
46 #endif
47 
48 #endif
49 
55 REMOTE_SERVICE_JOB_PREFIX const char * const RSJ_TYPE_S REMOTE_SERVICE_JOB_VAL ("remote_service_job");
56 
57 
65 typedef struct RemoteServiceJob
66 {
69 
71  char *rsj_uri_s;
72 
75 
78 
80 
81 
82 
83 #ifdef __cplusplus
84 extern "C"
85 {
86 #endif
87 
88 
101 GRASSROOTS_SERVICE_API RemoteServiceJob *AllocateRemoteServiceJob (struct Service *service_p, const char *job_name_s, const char *job_description_s, const char *remote_service_s, const char *remote_uri_s, uuid_t remote_job_id);
102 
103 
111 
112 
128 GRASSROOTS_SERVICE_API RemoteServiceJob *CreateRemoteServiceJobFromResultsJSON (const char *remote_service_s, const char *remote_uri_s, const uuid_t remote_job_id, const json_t *results_p, struct Service *service_p, const char *job_name_s, const char *job_description_s, OperationStatus status);
129 
130 
139 GRASSROOTS_SERVICE_API bool IsRemoteServiceJobJSON (const json_t *job_json_p);
140 
141 
142 
150 GRASSROOTS_SERVICE_API RemoteServiceJob *GetRemoteServiceJobFromJSON (const json_t *job_json_p, struct Service *service_p, GrassrootsServer *grassroots_p);
151 
152 
153 
163 GRASSROOTS_SERVICE_API json_t *GetRemoteServiceJobAsJSON (RemoteServiceJob *job_p, bool omit_results_flag);
164 
165 
177 GRASSROOTS_SERVICE_API bool SetRemoteServiceJobDetails (RemoteServiceJob *remote_job_p, const char *remote_service_s, const char *remote_uri_s, const uuid_t remote_job_id);
178 
179 
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 
186 #endif /* SERVICES_LIB_INCLUDE_REMOTE_SERVICE_JOB_H_ */
RemoteServiceJob::rsj_job
ServiceJob rsj_job
The base ServiceJob.
Definition: remote_service_job.h:68
RemoteServiceJob
A datatype describing a ServiceJob that is run on a remote Grassroots Server.
Definition: remote_service_job.h:65
ServiceJob
A datatype to represent a running task.
Definition: service_job.h:72
grassroots_service_library.h
RemoteServiceJob::SetRemoteServiceJobDetails
bool SetRemoteServiceJobDetails(RemoteServiceJob *remote_job_p, const char *remote_service_s, const char *remote_uri_s, const uuid_t remote_job_id)
Set the RemoteServiceJob-specific details for a given RemoteServiceJob.
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
RemoteServiceJob::FreeRemoteServiceJob
void FreeRemoteServiceJob(ServiceJob *job_p)
Free the RemoteServiceJob.
RemoteServiceJob::AllocateRemoteServiceJob
RemoteServiceJob * AllocateRemoteServiceJob(struct Service *service_p, const char *job_name_s, const char *job_description_s, const char *remote_service_s, const char *remote_uri_s, uuid_t remote_job_id)
Allocate a RemoteServiceJob.
RemoteServiceJob::rsj_remote_job_id
uuid_t rsj_remote_job_id
The UUID of the RemoteServiceJob on its remote Server.
Definition: remote_service_job.h:77
RemoteServiceJob::rsj_service_name_s
char * rsj_service_name_s
The name of the Service that will run the RemoteServiceJob.
Definition: remote_service_job.h:74
RemoteServiceJob::GetRemoteServiceJobFromJSON
RemoteServiceJob * GetRemoteServiceJobFromJSON(const json_t *job_json_p, struct Service *service_p, GrassrootsServer *grassroots_p)
Create a RemoteServiceJob from a given JSON fragment.
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
RemoteServiceJob::CreateRemoteServiceJobFromResultsJSON
RemoteServiceJob * CreateRemoteServiceJobFromResultsJSON(const char *remote_service_s, const char *remote_uri_s, const uuid_t remote_job_id, const json_t *results_p, struct Service *service_p, const char *job_name_s, const char *job_description_s, OperationStatus status)
Create a RemoteServiceJob from the JSON fragment returned from the ExternalServer that ran the job.
OperationStatus
OperationStatus
The current status of an Operation.
Definition: operation.h:96
service_job.h
RemoteServiceJob::RSJ_TYPE_S
const char *const RSJ_TYPE_S
The job type for RemoteServiceJobs.
Definition: remote_service_job.h:55
RemoteServiceJob::GetRemoteServiceJobAsJSON
json_t * GetRemoteServiceJobAsJSON(RemoteServiceJob *job_p, bool omit_results_flag)
Create a given JSON fragment for a given RemoteServiceJob.
GrassrootsServer
Definition: grassroots_server.h:45
RemoteServiceJob::rsj_uri_s
char * rsj_uri_s
The URI for the ExternalServer that is running the RemoteServiceJob.
Definition: remote_service_job.h:71
RemoteServiceJob::IsRemoteServiceJobJSON
bool IsRemoteServiceJobJSON(const json_t *job_json_p)
Test whether a given JSON object represents a RemoteServiceJob.
uuid_t
Definition: windows_uuid.h:43