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.
|
Go to the documentation of this file.
22 #ifndef GRASSROOTS_SERVICE_H
23 #define GRASSROOTS_SERVICE_H
62 #ifndef DOXYGEN_SHOULD_SKIP_THIS
64 #ifdef ALLOCATE_PATH_TAGS
65 #define PATH_PREFIX GRASSROOTS_SERVICE_API
66 #define PATH_VAL(x) = x
68 #define PATH_PREFIX extern GRASSROOTS_SERVICE_API
81 #define SERVICE_GROUP_ALIAS_SEPARATOR "-"
212 const char *(*se_get_service_name_fn) (
const struct Service *service_p);
217 const char *(*se_get_service_description_fn) (
const struct Service *service_p);
223 const char *(*se_get_service_alias_fn) (
const struct Service *service_p);
228 const char *(*se_get_service_info_uri_fn) (
const struct Service *service_p);
274 struct ServiceJob *(*se_deserialise_job_json_fn) (
struct Service *service_p,
const json_t *service_job_json_p);
285 json_t *(*se_serialise_job_json_fn) (
struct Service *service_p,
struct ServiceJob *service_job_p,
bool omit_results_flag);
380 json_t *(*se_get_indexing_data_fn) (
struct Service *service_p);
388 Parameter *(*se_custom_parameter_decoder_fn) (
struct Service *service_p, json_t *param_json_p,
const bool concise_flag);
489 const char *(*get_service_name_fn) (
const Service *service_p),
490 const char *(*get_service_description_fn) (
const Service *service_p),
491 const char *(*get_service_alias_fn) (
const Service *service_p),
492 const char *(*get_service_info_uri_fn) (
const Service *service_p),
496 bool (*get_parameter_type_fn) (
const Service *service_p,
const char *param_name_s,
ParameterType *pt_p),
498 bool (*close_fn) (
Service *service_p),
504 json_t *(*get_indexing_data_fn) (
Service *service_p),
The datatype that stores all of the information about a Parameter.
Definition: parameter.h:121
struct ServiceJobSet * se_jobs_p
The ServiceJobSet for this Service.
Definition: service.h:322
GrassrootsServer * se_grassroots_p
The server that this service is running on.
Definition: service.h:393
uint32 sa_num_services
The number of Services in the array.
Definition: service.h:428
Synchronicity
A datatype to define how a Service runs.
Definition: service.h:101
Service * sn_service_p
The Service.
Definition: service.h:413
json_t * GetServiceIndexingData(Service *service_p)
Get a JSON document containing the data that can be parsed by an indexing app such as Lucene.
This is a datatype to store the versioning details for the Grassroots JSON schema that is being used.
Definition: schema_version.h:44
ParameterSet * GetServiceParameters(Service *service_p, DataResource *resource_p, User *user_p)
Get a newly-created ParameterSet describing the parameters for a given Service.
GrassrootsServer * GetGrassrootsServerFromService(const Service *const service_p)
Get the GrassrootsServer that the Service is running on.
A datatype for storing Services on a LinkedList.
Definition: service.h:407
json_t * GetServiceRefreshRequestFromJSON(const char *const service_name_s, json_t *param_set_json_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
ServiceNode * AllocateServiceNode(Service *service_p)
Allocate a ServiceNode pointing to the given Service.
Service ** sa_services_pp
An array of pointers to Services.
Definition: service.h:425
A datatype to allow access to an external Grassroots Server.
Definition: servers_manager.h:48
void SetMetadataForService(Service *service_p, SchemaTerm *category_p, SchemaTerm *subcategory_p)
Set the values of a Service's ServiceMetadata object.
This is a datatype that stores a read-only c-style string along with a ParameterType.
Definition: parameter.h:85
ParameterType
The different types that a Parameter can take.
Definition: parameter_type.h:35
A datatype to represent a running task.
Definition: service_job.h:72
ServicesArray * AllocateServicesArray(const uint32 num_services)
Allocate an empty ServicesArray.
bool AddServiceJobToService(Service *service_p, ServiceJob *job_p)
Add a ServiceJob to a Service.
LinkedList se_paired_services
Any remote Services that are paired with this Service.
Definition: service.h:325
void SetServiceReleaseFunction(Service *service_p, void(*release_fn)(Service *service_p))
For an asynchronous Service, set the function that will be called if ReleaseService() is called.
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
ServicesArray * GetReferenceServicesFromJSON(json_t *config_p, const char *plugin_name_s, Service *(*get_service_fn)(json_t *config_p, size_t i, GrassrootsServer *grassroots_p), GrassrootsServer *grassroots_p)
Get the ServicesArray generated from a Services reference file.
json_t * GetServiceRefreshRequest(const char *const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
Get the JSON fragment for sending to a Grassroots Server detailing how to update the parameters for a...
A datatype representing a URI.
Definition: data_resource.h:40
bool(* se_get_parameter_type_fn)(const struct Service *service_p, const char *param_name_s, ParameterType *pt_p)
Callback function used to get the ParameterType of a named Parameter used by the given Service.
Definition: service.h:310
struct ServiceJob * CreateSerialisedServiceJobFromService(struct Service *service_p, const json_t *service_job_json_p)
Function to parse a JSON fragment from a previously serialised ServiceJob.
bool CreateAndAddLinkedService(Service *service_p, const json_t *service_config_p, GrassrootsServer *grassroots_p)
Create and add a LinkedService to a Service.
json_t * GetServiceRunRequest(const char *const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
Get the JSON fragment for sending to a Grassroots Server detailing whether and how a user wants a Ser...
void ReleaseService(Service *service_p)
For an asynchronous Service, tell it that it is no longer needed by the Grassroots system.
bool se_is_specific_service_flag
Is the service self-contained.
Definition: service.h:168
uuid_t se_id
Unique Id for this service.
Definition: service.h:319
#define GRASSROOTS_SERVICE_LOCAL
Definition: grassroots_service_library.h:50
struct Plugin * se_plugin_p
The platform-specific plugin that the code for the Service is stored in.
Definition: service.h:159
ServicesArray * GetReferrableServicesFromPlugin(Plugin *const plugin_p, User *user_p, const json_t *service_config_p)
Get the ServicesArray from a given Plugin.
bool GetParameterTypeForNamedParameter(const struct Service *service_p, const char *param_name_s, ParameterType *pt_p)
Get the ParameterType of a named Parameter used by the given Service.
void FreeServicesArray(ServicesArray *services_p)
Free a ServicesArray and each of its Services.
struct ServiceJobSet * RunService(Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p)
Run a Service.
bool CreateAndAddPairedService(Service *service_p, struct ExternalServer *external_server_p, const char *remote_service_name_s, const json_t *op_p, const json_t *provider_p)
Create a new PairedService and add it to a Service.
void ReleaseServiceParameters(Service *service_p, ParameterSet *params_p)
Free a ParameterSet that was got from a call to GetServiceParameters.
void FreeServiceNode(ListItem *node_p)
Free a ServiceNode.
bool(* se_process_linked_services_fn)(struct Service *service_p, struct ServiceJob *job_p, LinkedService *linked_service_p)
Callback function used when processing the results from running ServiceJobs for this Service as input...
Definition: service.h:298
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
json_t * CreateSerialisedJSONForServiceJobFromService(struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag)
Function to create a JSON fragment representing a serialised ServiceJob.
bool DeallocatePluginService(Plugin *const plugin_p)
Close a Services-based Plugin and free all of the Services.
bool sd_config_flag
If this is true, then this ServiceData will decrease the reference count on sd_config_p when this Ser...
Definition: service.h:141
A datatype for having a set of Services.
Definition: service.h:422
SyncData * se_sync_data_p
If the Service's synchronicity is set to SY_ASYNCHRONOUS_ATTACHED, this is used as mutex to control a...
Definition: service.h:364
Synchronicity se_synchronous
The synchronicity for how this Service runs.
Definition: service.h:316
bool SortServicesListByName(LinkedList *services_list_p)
ListItem sn_node
The List Node.
Definition: service.h:410
char * GetServiceUUIDAsString(Service *service_p)
Get the unique id of a service object.
ParameterLevel
The ParameterLevel defines the level that a user should be to adjust the Parameter.
Definition: parameter.h:52
bool RemoveServiceJobFromService(Service *service_p, ServiceJob *job_p)
Remove a ServiceJob from a Service.
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
json_t * GetServiceRunRequestFromJSON(const char *const service_name_s, json_t *param_set_json_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
json_t * GetInterestedServiceJSON(Service *service_p, const char *keyword_s, const ParameterSet *const params_p, const bool full_definition_flag)
Get the JSON fragment for a job result list registering that a Service could be run against the user'...
This datatype stores the data needed to get the required information from the output of one Service t...
Definition: linked_service.h:50
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
bool(* se_has_permissions_fn)(struct Service *service_p, ParameterSet *params_p, const User *const user_p)
Check whether the user have permissions to run the Service.
Definition: service.h:206
void(* se_release_params_fn)(struct Service *service_p, ParameterSet *params_p)
Function to release the ParameterSet for this Service.
Definition: service.h:253
json_t * GetBaseServiceDataAsJSON(Service *const service_p, User *user_p)
OperationStatus
The current status of an Operation.
Definition: operation.h:96
bool IsServiceRunning(Service *service_p)
Check if a Service is currently running any ServiceJobs.
json_t * sd_config_p
If this service has an entry in global server config it will be stored here.
Definition: service.h:135
A datatype that allows data to be shared between tasks (e.g.
Definition: linux_sync_data.h:30
A Plugin is a dynamically-loaded component to provide a piece of functionality.
Definition: plugin.h:150
void(* se_customise_service_job_fn)(struct Service *service_p, struct ServiceJob *job_p)
This function is used to customise any ServiceJob objects that this Service creates.
Definition: service.h:247
bool se_running_flag
A flag to specify whether this Service is currently running.
Definition: service.h:343
const char * GetServiceInformationURI(const Service *service_p)
Get the address of a web page about the service.
bool CloseService(Service *service_p)
Close a Service.
const char * GetServiceName(const Service *service_p)
Get the user-friendly name of the service.
bool AddPairedService(Service *service_p, PairedService *paired_service_p)
Add a PairedService to a Service.
const char * GetServiceAlias(const Service *service_p)
Get the alias of the service.
A datatype for describing a remote Service that can be used in conjunction with a local Service.
Definition: paired_service.h:59
ParameterSet * IsServiceMatch(Service *service_p, DataResource *resource_p, Handler *handler_p)
Is the Service able to work upon the given Resource.
Definition: grassroots_server.h:45
A datatype to represent a collection of ServiceJobs.
Definition: service_job.h:185
A task that runs synchronously.
Definition: service.h:104
A datatype to store user credentials.
Definition: user_details.h:40
A task runs asynchronously within the Grassroots system such as e.g threaded jobs.
Definition: service.h:116
void SetServiceRunning(Service *service_p, bool b)
Set if a Service is currently running any ServiceJobs or not.
bool DefaultGetParameterTypeForNamedParameter(const char *param_name_s, ParameterType *pt_p, const NamedParameterType *params_p)
ServicesArray * GetServicesFromPlugin(Plugin *const plugin_p, User *user_p)
Get the ServicesArray from a given Plugin.
bool(* se_close_fn)(struct Service *service_p)
Function to close this Service.
Definition: service.h:262
OperationStatus GetCurrentServiceStatus(Service *service_p, const uuid_t service_id)
Get the OperationStatus for an operation in a Service.
A datatype for holding the configuration data for a Service.
Definition: service.h:126
bool DoesServiceHaveCustomServiceJobSerialisation(struct Service *service_p)
Does the Service use the default ServiceJob serialisation/deserialisation when storing ServiceJobs in...
bool AddLinkedService(Service *service_p, LinkedService *paired_service_p)
Add a LinkedService to a Service.
void(* se_release_service_fn)(struct Service *service_p)
A custom callback function to use to close the service if needed.
Definition: service.h:371
ServiceData * se_data_p
Any custom data that the service needs to store.
Definition: service.h:336
A Handler is a datatype for accessing data.
Definition: handler.h:72
bool InitialiseService(Service *const service_p, const char *(*get_service_name_fn)(const Service *service_p), const char *(*get_service_description_fn)(const Service *service_p), const char *(*get_service_alias_fn)(const Service *service_p), const char *(*get_service_info_uri_fn)(const Service *service_p), struct ServiceJobSet *(*run_fn)(Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p), ParameterSet *(*match_fn)(Service *service_p, DataResource *resource_p, Handler *handler_p), ParameterSet *(*get_parameters_fn)(Service *service_p, DataResource *resource_p, User *user_p), bool(*get_parameter_type_fn)(const Service *service_p, const char *param_name_s, ParameterType *pt_p), void(*release_parameters_fn)(Service *service_p, ParameterSet *params_p), bool(*close_fn)(Service *service_p), void(*customise_service_job_fn)(Service *service_p, struct ServiceJob *job_p), bool specific_flag, Synchronicity synchronous, ServiceData *data_p, ServiceMetadata *(*get_metadata_fn)(Service *service_p), json_t *(*get_indexing_data_fn)(Service *service_p), GrassrootsServer *grassroots_p)
Initialise the basic structure of a Service.
bool AddServiceResponseHeader(Service *service_p, json_t *result_json_p)
Add a JSON fragment to the response for a given Service that has been run.
const char * GetServiceDescription(const Service *service_p)
Get the user-friendly description of the service.
ServiceMetadata * se_metadata_p
The ServiceMetadata for this Service.
Definition: service.h:348
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
struct Service * sd_service_p
The service that owns this data.
Definition: service.h:129
A datatype for specifying ontological terms as a way to describe the data that each of the Services c...
Definition: schema_term.h:38
LinkedList se_linked_services
Any LinkedServices that will use the output from running this Service as input for itself.
Definition: service.h:331
A task that runs asynchronously outside of the Grassroots system such as e.g drmaa jobs.
Definition: service.h:110
const char * GetServiceIcon(const Service *service_p)
Get the URL of an icon image to use for a given Service.
void FreeService(Service *service_p)
Free a Service and its associated Parameters and ServiceData.
const char * GetServiceInformationPage(const Service *service_p)
Get the URL of a web page describing a given Service.
json_t * GetServiceAsJSON(Service *const service_p, DataResource *resource_p, User *user_p, const bool add_id_flag)
Generate a json-based description of a Service.
void SetServiceJobCustomFunctions(Service *service_p, struct ServiceJob *job_p)
This function is used to customise any ServiceJob objects that a given Service creates.
json_t * GetServicesListAsJSON(LinkedList *services_list_p, DataResource *resource_p, User *user_p, const bool add_service_ids_flag, ProvidersStateTable *providers_p)
Get the JSON fragment for exposing a list of Services to any interested Clients or ExternalServcers.
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
Definition: windows_uuid.h:43