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.
paired_service.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  * paired_service.h
24  *
25  * Created on: 1 Feb 2016
26  * Author: billy
27  */
28 
29 #ifndef PAIRED_SERVICE_H_
30 #define PAIRED_SERVICE_H_
31 
32 
33 
34 #include "jansson.h"
35 #include "uuid_defs.h"
36 
37 #include "parameter_set.h"
38 #include "linked_list.h"
40 
41 #include "providers_state_table.h"
42 #include "parameter_set.h"
43 #include "service_job.h"
44 
45 
46 /* forward declarations */
47 struct Service;
48 struct ServiceData;
49 struct RemoteServiceJob;
50 
51 
59 typedef struct PairedService
60 {
63 
65  char *ps_name_s;
66 
69 
72 
74  json_t *ps_provider_p;
75 
79 
80 
88 typedef struct PairedServiceNode
89 {
92 
96 
97 
98 #ifdef __cplusplus
99 extern "C"
100 {
101 #endif
102 
103 
116 GRASSROOTS_SERVICE_API PairedService *AllocatePairedService (const uuid_t id, const char *name_s, const char *server_uri_s, const char *server_name_s, const json_t *service_json_p, const json_t *provider_p);
117 
118 
126 
127 
136 
137 
151 GRASSROOTS_SERVICE_API PairedServiceNode *AllocatePairedServiceNodeByParts (const uuid_t id, const char *name_s, const char *server_uri_s, const char *server_name_s, const json_t *op_p, const json_t *provider_p);
152 
153 
161 
162 
173 GRASSROOTS_SERVICE_API json_t *MakeRemotePairedServiceCall (const char * const service_name_s, ParameterSet *params_p, const char * const paired_service_uri_s, ProvidersStateTable *providers_p, GrassrootsServer *grassroots_p);
174 
175 
176 
193 GRASSROOTS_SERVICE_API int32 RunPairedServices (struct Service *service_p, ParameterSet *param_set_p, ProvidersStateTable *providers_p, bool (*save_job_fn) (struct RemoteServiceJob *job_p, const struct ServiceData *service_data_p));
194 
195 
214 GRASSROOTS_SERVICE_API int32 AddRemoteResultsToServiceJobs (const json_t *server_response_p, struct Service *service_p, const char * const remote_service_s, const char * const remote_uri_s, const struct ServiceData *service_data_p, bool (*save_job_fn) (struct RemoteServiceJob *job_p, const struct ServiceData *service_data_p));
215 
216 
217 
218 #ifdef __cplusplus
219 }
220 #endif
221 
222 #endif /* PAIRED_SERVICE_H_ */
PairedService::MakeRemotePairedServiceCall
json_t * MakeRemotePairedServiceCall(const char *const service_name_s, ParameterSet *params_p, const char *const paired_service_uri_s, ProvidersStateTable *providers_p, GrassrootsServer *grassroots_p)
Call the PairedService and get its JSON response.
PairedServiceNode
A datatype for storing PairedServices on a LinkedList.
Definition: paired_service.h:88
PairedServiceNode::AllocatePairedServiceNodeByParts
PairedServiceNode * AllocatePairedServiceNodeByParts(const uuid_t id, const char *name_s, const char *server_uri_s, const char *server_name_s, const json_t *op_p, const json_t *provider_p)
Allocate a PairedService and attach it to a PairedServiceNode.
RemoteServiceJob
A datatype describing a ServiceJob that is run on a remote Grassroots Server.
Definition: remote_service_job.h:65
grassroots_service_library.h
parameter_set.h
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
PairedService::ps_name_s
char * ps_name_s
The name of the PairedService.
Definition: paired_service.h:65
PairedServiceNode::AllocatePairedServiceNode
PairedServiceNode * AllocatePairedServiceNode(PairedService *paired_service_p)
Allocate a PairedServiceNode.
providers_state_table.h
PairedService::AddRemoteResultsToServiceJobs
int32 AddRemoteResultsToServiceJobs(const json_t *server_response_p, struct Service *service_p, const char *const remote_service_s, const char *const remote_uri_s, const struct ServiceData *service_data_p, bool(*save_job_fn)(struct RemoteServiceJob *job_p, const struct ServiceData *service_data_p))
Add the results of running PairedServices as RemoteServiceJobs to the ServiceJobSet of a given Servic...
PairedService::RunPairedServices
int32 RunPairedServices(struct Service *service_p, ParameterSet *param_set_p, ProvidersStateTable *providers_p, bool(*save_job_fn)(struct RemoteServiceJob *job_p, const struct ServiceData *service_data_p))
Run all of the PairedServices for a given Service.
PairedService::FreePairedService
void FreePairedService(PairedService *paired_service_p)
Free a PairedService.
PairedService::ps_provider_p
json_t * ps_provider_p
The JSON fragment detailing the Provider of this PairedService.
Definition: paired_service.h:74
PairedServiceNode::FreePairedServiceNode
void FreePairedServiceNode(ListItem *node_p)
Free a PairedServiceNode.
PairedService::ps_extenal_server_id
uuid_t ps_extenal_server_id
The UUID for the ExternalServer that runs the PairedService.
Definition: paired_service.h:62
uuid_defs.h
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
PairedServiceNode::psn_node
ListItem psn_node
The base list node.
Definition: paired_service.h:91
PairedService::ps_server_uri_s
char * ps_server_uri_s
The URI of the ExternalServer's Grassroots service.
Definition: paired_service.h:71
ProvidersStateTable
This is a datatype that is used to keep track of which servers and services have already been process...
Definition: providers_state_table.h:49
PairedService::ps_params_p
ParameterSet * ps_params_p
The ParameterSet for this PairedService.
Definition: paired_service.h:77
service_job.h
PairedService
A datatype for describing a remote Service that can be used in conjunction with a local Service.
Definition: paired_service.h:59
GrassrootsServer
Definition: grassroots_server.h:45
PairedServiceNode::psn_paired_service_p
PairedService * psn_paired_service_p
The PairedService.
Definition: paired_service.h:94
PairedService::ps_server_name_s
char * ps_server_name_s
The name of the ExternalServer.
Definition: paired_service.h:68
linked_list.h
A doubly-linked list.
ServiceData
A datatype for holding the configuration data for a Service.
Definition: service.h:126
PairedService::AllocatePairedService
PairedService * AllocatePairedService(const uuid_t id, const char *name_s, const char *server_uri_s, const char *server_name_s, const json_t *service_json_p, const json_t *provider_p)
Allocate a PairedService.
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
uuid_t
Definition: windows_uuid.h:43