PairedService Struct Reference

A datatype for describing a remote Service that can be used in conjunction with a local Service. More...

#include <paired_service.h>

Collaboration diagram for PairedService:
[legend]

Public Member Functions

PairedServiceAllocatePairedService (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. More...
 
void FreePairedService (PairedService *paired_service_p)
 Free a PairedService. More...
 
json_t * MakeRemotePairedServiceCall (const char *const service_name_s, ParameterSet *params_p, const char *const paired_service_uri_s, ProvidersStateTable *providers_p)
 Call the PairedService and get its JSON response. More...
 
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. More...
 
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 Service. More...
 

Data Fields

uuid_t ps_extenal_server_id
 The UUID for the ExternalServer that runs the PairedService. More...
 
char * ps_name_s
 The name of the PairedService. More...
 
char * ps_server_name_s
 The name of the ExternalServer. More...
 
char * ps_server_uri_s
 The URI of the ExternalServer's Grassroots service. More...
 
json_t * ps_provider_p
 The JSON fragment detailing the Provider of this PairedService. More...
 
ParameterSetps_params_p
 The ParameterSet for this PairedService. More...
 

Detailed Description

A datatype for describing a remote Service that can be used in conjunction with a local Service.

Member Function Documentation

◆ 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.

Parameters
idThe UUID of the ExternalServer that has the PairedService.
name_sThe name of the PairedService.
server_uri_sThe URI for the ExternalServer's Grassroots access.
server_name_sThe name of the ExternalServer.
service_json_pThe JSON fragment for the Service.
provider_pThe JSON fragment from the server configuration file detailing the Provider of this PairedService.
Returns
The new PairedService or NULL upon error.

◆ FreePairedService()

void FreePairedService ( PairedService paired_service_p)

Free a PairedService.

Parameters
paired_service_pThe PairedService to free.

◆ MakeRemotePairedServiceCall()

json_t * MakeRemotePairedServiceCall ( const char *const  service_name_s,
ParameterSet params_p,
const char *const  paired_service_uri_s,
ProvidersStateTable providers_p 
)

Call the PairedService and get its JSON response.

Parameters
service_name_sThe name of the PairedServce to call.
params_pThe ParameterSet to send to the PairedService.
paired_service_uri_sThe URI of the ExternalServer to send the request to.
providers_pThe details of ExternalServers for any paired or external Services.
Returns
The JSON fragment of the results of the PairedService or NULL upon error.

◆ RunPairedServices()

int32 RunPairedServices ( struct Service service_p,
ParameterSet param_set_p,
ProvidersStateTable providers_p,
bool(*)(struct RemoteServiceJob *job_p, const struct ServiceData *service_data_p)  save_job_fn 
)

Run all of the PairedServices for a given Service.

These will be added as RemoteServiceJobs to the ServiceJobSet of this Service by calling AddRemoteResultsToServiceJobs().

Parameters
service_pThe Service to run the PairedServices for.
param_set_pThe ParameterSet to send to the PairedService.
providers_pThe details of ExternalServers for any paired or external Services.
save_job_fnIf you need any extra processing of the resulting RemoteServiceJobs this function can be used. It will be called passing each RemoteServiceJob in turn along with the ServiceData for this Service. if the processing was successful it will return true, with false upon failure.
Returns
The number of PairedServices that were ran successfully.

◆ 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(*)(struct RemoteServiceJob *job_p, const struct ServiceData *service_data_p)  save_job_fn 
)

Add the results of running PairedServices as RemoteServiceJobs to the ServiceJobSet of a given Service.

Parameters
server_response_pThe response from the remote Grassroots Server that was called to run the PairedServices.
service_pThe Service that will have the RemoteServiceJobs added to it.
remote_service_sThe name of the remote Service that was called.
remote_uri_sThe URL of the remote Grassroots Server that was called to run the PairedServices.
service_data_pThe ServiceData for the given Service.
save_job_fnIf you need any extra processing of the resulting RemoteServiceJobs this function can be used. It will be called passing each RemoteServiceJob in turn along with the ServiceData for this Service. if the processing was successful it will return true, with false upon failure.
Returns
The number of PairedServices that were ran successfully.

Field Documentation

◆ ps_extenal_server_id

uuid_t ps_extenal_server_id

The UUID for the ExternalServer that runs the PairedService.

◆ ps_name_s

char* ps_name_s

The name of the PairedService.

◆ ps_server_name_s

char* ps_server_name_s

The name of the ExternalServer.

◆ ps_server_uri_s

char* ps_server_uri_s

The URI of the ExternalServer's Grassroots service.

◆ ps_provider_p

json_t* ps_provider_p

The JSON fragment detailing the Provider of this PairedService.

◆ ps_params_p

ParameterSet* ps_params_p

The ParameterSet for this PairedService.


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