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.
|
This datatype stores the data needed to get the required information from the output of one Service to act as input for another. More...
#include <linked_service.h>
Public Member Functions | |
LinkedService * | AllocateLinkedService (const char *linked_service_s, const char *input_key_s, const json_t *mapped_params_json_p, const char *const function_s, const json_t *config_p, GrassrootsServer *grassroots_p) |
Allocate a LinkedService. More... | |
LinkedService * | CreateLinkedServiceFromJSON (struct Service *service_p, const json_t *linked_service_json_p, GrassrootsServer *grassroots_p) |
Create a new LinkedService from a JSON fragment. More... | |
void | FreeLinkedService (LinkedService *linked_service_p) |
Free a LinkedService. More... | |
LinkedServiceNode * | AllocateLinkedServiceNode (LinkedService *linked_service_p) |
Allocate a LinkedServiceNode to store a LinkedService on a LinkedList. More... | |
void | FreeLinkedServiceNode (ListItem *node_p) |
Free a LinkedServiceNode and its associated LinkedService. More... | |
bool | CreateAndAddMappedParameterToLinkedService (LinkedService *linked_service_p, const char *input_s, const char *output_s, bool required_flag, bool multi_flag) |
Create and add a MappedParameter to a LinkedService. More... | |
bool | AddMappedParameterToLinkedService (LinkedService *linked_service_p, struct MappedParameter *mapped_param_p) |
Add a MappedParameter to a LinkedService. More... | |
json_t * | GetLinkedServiceAsJSON (LinkedService *linked_service_p) |
Get the JSON representation of a LinkedService. More... | |
bool | ProcessLinkedService (LinkedService *linked_service_p, struct ServiceJob *job_p) |
Run a LinkedService. More... | |
bool | AddLinkedServiceToRequestJSON (json_t *request_p, LinkedService *linked_service_p, ParameterSet *output_params_p) |
Add the details for how to run a LinkedService with a partially-filled in set of Parameters to a JSON fragment to be sent to a client. More... | |
MappedParameter * | CreateMappedParameterFromJSON (const json_t *mapped_param_json_p) |
Create a new MappedParameter from a JSON fragment. More... | |
Data Fields | |
char * | ls_output_service_s |
The name of the Service whose input will be generated from the output of the Service that owns this LinkedService object. More... | |
LinkedList * | ls_mapped_params_p |
The list of MappedParameterNodes storing the information required to map values from the input Service's results to be input for the Service that owns this LinkedService object. More... | |
const char * | ls_generate_fn_s |
The name of the function that will get dynamically loaded from the Service's Plugin. More... | |
char * | ls_input_key_s |
const json_t * | ls_config_p |
GrassrootsServer * | ls_grassroots_p |
This datatype stores the data needed to get the required information from the output of one Service to act as input for another.
LinkedService * AllocateLinkedService | ( | const char * | linked_service_s, |
const char * | input_key_s, | ||
const json_t * | mapped_params_json_p, | ||
const char *const | function_s, | ||
const json_t * | config_p, | ||
GrassrootsServer * | grassroots_p | ||
) |
Allocate a LinkedService.
input_service_s | The name of the input service. The LinkedService will make a deep copy of this and store that value. |
input_key_s | The key for each result to generate a link for. This can be NULL if there is only a single object. The LinkedService will make a deep copy of this and store that value. |
NULL
upon error. LinkedService * CreateLinkedServiceFromJSON | ( | struct Service * | service_p, |
const json_t * | linked_service_json_p, | ||
GrassrootsServer * | grassroots_p | ||
) |
Create a new LinkedService from a JSON fragment.
linked_service_json_p | The JSON fragment describing the LinkedService. |
NULL
upon error. void FreeLinkedService | ( | LinkedService * | linked_service_p | ) |
Free a LinkedService.
linked_service_p | The LinkedService to free. |
LinkedServiceNode * AllocateLinkedServiceNode | ( | LinkedService * | linked_service_p | ) |
Allocate a LinkedServiceNode to store a LinkedService on a LinkedList.
linked_service_p | The LinkedService to store in this LinkedServiceNode. |
NULL
upon error. void FreeLinkedServiceNode | ( | ListItem * | node_p | ) |
Free a LinkedServiceNode and its associated LinkedService.
node_p | The LinkedServiceNode to free. |
bool CreateAndAddMappedParameterToLinkedService | ( | LinkedService * | linked_service_p, |
const char * | input_s, | ||
const char * | output_s, | ||
bool | required_flag, | ||
bool | multi_flag | ||
) |
Create and add a MappedParameter to a LinkedService.
This calls AllocateMappedParameter and AddMappedParameterToLinkedService.
linked_service_p | The LinkedService to add the MappedParameter to. |
input_s | The selector for the input Service's parameter. The new MappedParameter will make a deep copy of this value to store. |
output_s | The name of the output Service's parameter. The new MappedParameter will make a deep copy of this value to store. |
required_flag | Is this MappedParameter required or is optional to run the LinkedService? |
multi_flag | true if this MappedParameter can have multiple input values or false if it just has a single value. |
true
if the MappedParameter was created and added successfully, false
otherwise.bool AddMappedParameterToLinkedService | ( | LinkedService * | linked_service_p, |
struct MappedParameter * | mapped_param_p | ||
) |
Add a MappedParameter to a LinkedService.
linked_service_p | The LinkedService to add the MappedParameter to. |
mapped_param_p | The MappedParameter to add. |
true
if the MappedParameter was added successfully, false
otherwise. json_t * GetLinkedServiceAsJSON | ( | LinkedService * | linked_service_p | ) |
Get the JSON representation of a LinkedService.
linked_service_p | The LinkedService to serialise. |
bool ProcessLinkedService | ( | LinkedService * | linked_service_p, |
struct ServiceJob * | job_p | ||
) |
Run a LinkedService.
linked_service_p | The LinkedService to run. |
job_p | The ServiceJob that the results of running the LinkedService will be added to. |
true
if the LinkedService was run successfully, false
otherwise. bool AddLinkedServiceToRequestJSON | ( | json_t * | request_p, |
LinkedService * | linked_service_p, | ||
ParameterSet * | output_params_p | ||
) |
Add the details for how to run a LinkedService with a partially-filled in set of Parameters to a JSON fragment to be sent to a client.
request_p | The JSON fragment that the details will be added to. |
linked_service_p | The LinkedService to add the details from. |
output_params_p | The ParameterSet to add to the partially-filled in Parameter values from. |
true
if the LinkedService JSON was added successfully, false
otherwise. MappedParameter * CreateMappedParameterFromJSON | ( | const json_t * | mapped_param_json_p | ) |
Create a new MappedParameter from a JSON fragment.
mapped_param_json_p | The JSON fragment describing the MappedParameter. |
NULL
upon error. char* ls_output_service_s |
The name of the Service whose input will be generated from the output of the Service that owns this LinkedService object.
LinkedList* ls_mapped_params_p |
The list of MappedParameterNodes storing the information required to map values from the input Service's results to be input for the Service that owns this LinkedService object.
const char* ls_generate_fn_s |
The name of the function that will get dynamically loaded from the Service's Plugin.
It should have a signature of the form:
bool (*generate_fn) (struct LinkedService *linked_service_p, json_t *data_p, struct ServiceJob *job_p);
char* ls_input_key_s |
const json_t* ls_config_p |
GrassrootsServer* ls_grassroots_p |