LinkedService Struct Reference

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>

Collaboration diagram for LinkedService:
[legend]

Public Member Functions

LinkedServiceAllocateLinkedService (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)
 Allocate a LinkedService. More...
 
LinkedServiceCreateLinkedServiceFromJSON (struct Service *service_p, const json_t *linked_service_json_p)
 Create a new LinkedService from a JSON fragment. More...
 
void FreeLinkedService (LinkedService *linked_service_p)
 Free a LinkedService. More...
 
LinkedServiceNodeAllocateLinkedServiceNode (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...
 
MappedParameterCreateMappedParameterFromJSON (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...
 
LinkedListls_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
 

Detailed Description

This datatype stores the data needed to get the required information from the output of one Service to act as input for another.

Member Function Documentation

◆ AllocateLinkedService()

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 
)

Allocate a LinkedService.

Parameters
input_service_sThe name of the input service. The LinkedService will make a deep copy of this and store that value.
input_key_sThe 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.
Returns
The newly-allocated LinkedService or NULL upon error.

◆ CreateLinkedServiceFromJSON()

LinkedService * CreateLinkedServiceFromJSON ( struct Service service_p,
const json_t *  linked_service_json_p 
)

Create a new LinkedService from a JSON fragment.

Parameters
linked_service_json_pThe JSON fragment describing the LinkedService.
Returns
The newly-allocated LinkedService or NULL upon error.

◆ FreeLinkedService()

void FreeLinkedService ( LinkedService linked_service_p)

Free a LinkedService.

Parameters
linked_service_pThe LinkedService to free.

◆ AllocateLinkedServiceNode()

LinkedServiceNode * AllocateLinkedServiceNode ( LinkedService linked_service_p)

Allocate a LinkedServiceNode to store a LinkedService on a LinkedList.

Parameters
linked_service_pThe LinkedService to store in this LinkedServiceNode.
Returns
The newly-allocated LinkedServiceNode or NULL upon error.

◆ FreeLinkedServiceNode()

void FreeLinkedServiceNode ( ListItem node_p)

Free a LinkedServiceNode and its associated LinkedService.

Parameters
node_pThe LinkedServiceNode to free.

◆ CreateAndAddMappedParameterToLinkedService()

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.

Parameters
linked_service_pThe LinkedService to add the MappedParameter to.
input_sThe selector for the input Service's parameter. The new MappedParameter will make a deep copy of this value to store.
output_sThe name of the output Service's parameter. The new MappedParameter will make a deep copy of this value to store.
required_flagIs this MappedParameter required or is optional to run the LinkedService?
multi_flagtrue if this MappedParameter can have multiple input values or false if it just has a single value.
Returns
true if the MappedParameter was created and added successfully, false otherwise.
See also
AllocateMappedParameter
AddMappedParameterToLinkedService

◆ AddMappedParameterToLinkedService()

bool AddMappedParameterToLinkedService ( LinkedService linked_service_p,
struct MappedParameter mapped_param_p 
)

Add a MappedParameter to a LinkedService.

Parameters
linked_service_pThe LinkedService to add the MappedParameter to.
mapped_param_pThe MappedParameter to add.
Returns
true if the MappedParameter was added successfully, false otherwise.

◆ GetLinkedServiceAsJSON()

json_t * GetLinkedServiceAsJSON ( LinkedService linked_service_p)

Get the JSON representation of a LinkedService.

Parameters
linked_service_pThe LinkedService to serialise.
Returns
The JSON fragment.

◆ ProcessLinkedService()

bool ProcessLinkedService ( LinkedService linked_service_p,
struct ServiceJob job_p 
)

Run a LinkedService.

Parameters
linked_service_pThe LinkedService to run.
job_pThe ServiceJob that the results of running the LinkedService will be added to.
Returns
true if the LinkedService was run successfully, false otherwise.

◆ AddLinkedServiceToRequestJSON()

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.

Parameters
request_pThe JSON fragment that the details will be added to.
linked_service_pThe LinkedService to add the details from.
output_params_pThe ParameterSet to add to the partially-filled in Parameter values from.
Returns
true if the LinkedService JSON was added successfully, false otherwise.

◆ CreateMappedParameterFromJSON()

MappedParameter * CreateMappedParameterFromJSON ( const json_t *  mapped_param_json_p)

Create a new MappedParameter from a JSON fragment.

Parameters
mapped_param_json_pThe JSON fragment describing the MappedParameter.
Returns
The newly-allocated MappedParameter or NULL upon error.

Field Documentation

◆ ls_output_service_s

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.

◆ ls_mapped_params_p

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.

◆ ls_generate_fn_s

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);


The documentation for this struct was generated from the following files: