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 is a datatype that is used to keep track of which servers and services have already been processed when merging services together to present to a server or client. More...
#include <providers_state_table.h>
Public Member Functions | |
ProvidersStateTable * | AllocateProvidersStateTable (const json_t *req_p) |
Allocate a ProvidersStateTable and populate it with any details within a specified json request. More... | |
void | FreeProvidersStateTable (ProvidersStateTable *providers_p) |
Deallocate a ProvidersStateTable. More... | |
ProvidersStateTable * | GetInitialisedProvidersStateTable (const json_t *req_p, LinkedList *services_p, GrassrootsServer *grassroots_p) |
Create a new ProvidersStateTable and populate it with any details within a specified json request and a list of Services for this Server. More... | |
ProvidersStateTable * | GetInitialisedProvidersStateTableForSingleService (const json_t *req_p, const char *const server_uri_s, const char *const service_s) |
Create a new ProvidersStateTable and populate it with any details within a specified json request and a single Server-Service pair. More... | |
bool | AddToProvidersStateTable (ProvidersStateTable *providers_p, const char *server_uri_s, const char *service_s) |
Add a server and service to a ProvidersStateTable. More... | |
bool | IsServiceInProvidersStateTable (const ProvidersStateTable *providers_p, const char *server_uri_s, const char *service_s) |
Check whether a given server and service are in a ProvidersStateTable. More... | |
json_t * | GetProvidersStateTableAsJSON (const ProvidersStateTable *providers_p) |
Get the json representation of a ProvidersStateTable. More... | |
json_t * | GetAvailableServicesRequestForAllProviders (const ProvidersStateTable *providers_p, User *user_p, const SchemaVersion *const sv_p) |
Create a json request that to get the list of all available Services making sure not to duplicate any Server-Service pairs stored within a given ProvidersStateTable. More... | |
bool | AddServicesListToProvidersStateTable (ProvidersStateTable *providers_p, LinkedList *services_p, GrassrootsServer *grassroots_p) |
Add a list of Services for this Server to a ProvidersStateTable. More... | |
bool | AddProvidersStateTableToRequest (const ProvidersStateTable *providers_p, json_t *req_p) |
Add the details to a json request to get the list of all available Services on a Server making sure not to duplicate any Server-Service pairs stored within a given ProvidersStateTable. More... | |
bool | InitProvidersStateTableFromRequest (ProvidersStateTable *const providers_p, const json_t *const req_p) |
Add the details from a json request to a given ProvidersStateTable. More... | |
bool | ClearProvidersStateTable (ProvidersStateTable *providers_p) |
Clear all of the servers and services that are being tracked within a ProvidersStateTable. More... | |
bool | ReinitProvidersStateTable (ProvidersStateTable *providers_p, const json_t *const req_p, const char *server_uri_s, const char *service_name_s) |
Clear a given ProvidersStateTable and add the details from a json request and a given Server-Service pair to it. More... | |
This is a datatype that is used to keep track of which servers and services have already been processed when merging services together to present to a server or client.
As requests are sent between connected Servers, a ProvidersStateTable maintains a list of the Services already used on each Server. This is used to, for instance, prevent deadlocks occurring where two Servers have connected Services with each other.
ProvidersStateTable * AllocateProvidersStateTable | ( | const json_t * | req_p | ) |
Allocate a ProvidersStateTable and populate it with any details within a specified json request.
req_p | The json_t request to populate the ProvidersStateTable with. Any previous ProvidersStateTable details will be stored by placing the output of GetProvidersStateTableAsJSON with the SERVERS_S key. |
NULL
upon error. void FreeProvidersStateTable | ( | ProvidersStateTable * | providers_p | ) |
Deallocate a ProvidersStateTable.
providers_p | The ProvidersStateTable to free. |
ProvidersStateTable * GetInitialisedProvidersStateTable | ( | const json_t * | req_p, |
LinkedList * | services_p, | ||
GrassrootsServer * | grassroots_p | ||
) |
Create a new ProvidersStateTable and populate it with any details within a specified json request and a list of Services for this Server.
req_p | The json_t request to populate the ProvidersStateTable with. Any previous ProvidersStateTable details will be stored by placing the output of GetProvidersStateTableAsJSON with the SERVERS_S key. |
services_p | A LinkedList of ServiceNodes that will get added to the ProvidersStateTable for this Server. |
NULL
upon error. ProvidersStateTable * GetInitialisedProvidersStateTableForSingleService | ( | const json_t * | req_p, |
const char *const | server_uri_s, | ||
const char *const | service_s | ||
) |
Create a new ProvidersStateTable and populate it with any details within a specified json request and a single Server-Service pair.
req_p | The json_t request to populate the ProvidersStateTable with. Any previous ProvidersStateTable details will be stored by placing the output of GetProvidersStateTableAsJSON with the SERVERS_S key. |
server_uri_s | The URI of the Server to add to the ProvidersStateTable if it is not already there. |
service_s | The name of the Service for the given Server that will be added to the ProvidersStateTable. |
NULL
upon error. bool AddToProvidersStateTable | ( | ProvidersStateTable * | providers_p, |
const char * | server_uri_s, | ||
const char * | service_s | ||
) |
Add a server and service to a ProvidersStateTable.
providers_p | The ProvidersStateTable to amend. |
server_uri_s | The unique identifier for a server. The URI for the server is used. |
service_s | The name of the service to add. |
true
if the service was added to the ProvidersStateTable successfully, false
otherwise. bool IsServiceInProvidersStateTable | ( | const ProvidersStateTable * | providers_p, |
const char * | server_uri_s, | ||
const char * | service_s | ||
) |
Check whether a given server and service are in a ProvidersStateTable.
providers_p | The ProvidersStateTable to check. |
server_uri_s | The URI for the server. |
service_s | The name of the service. |
true
if the server-service pair is in the given ProvidersStateTable, false
otherwise. json_t * GetProvidersStateTableAsJSON | ( | const ProvidersStateTable * | providers_p | ) |
Get the json representation of a ProvidersStateTable.
providers_p | The ProvidersStateTable to get the json representation of |
NULL
upon error. json_t * GetAvailableServicesRequestForAllProviders | ( | const ProvidersStateTable * | providers_p, |
User * | user_p, | ||
const SchemaVersion *const | sv_p | ||
) |
Create a json request that to get the list of all available Services making sure not to duplicate any Server-Service pairs stored within a given ProvidersStateTable.
providers_p | The ProvidersStateTable detailing all of the Server-Service pairs already processed. |
user_p | An optional User for the current User if access restrictions to any Server-Service combinations sent in response to the request generated by this method. |
sv_p | If you wish to create a JSON fragment for a different version of the Grassroots system, then you can set this value to the version that you require. If this is NULL , then the current version of the running Grassroots system will be used. |
NULL
upon error. bool AddServicesListToProvidersStateTable | ( | ProvidersStateTable * | providers_p, |
LinkedList * | services_p, | ||
GrassrootsServer * | grassroots_p | ||
) |
Add a list of Services for this Server to a ProvidersStateTable.
providers_p | The ProvidersStateTable to add the Service definitions to. |
services_p | A LinkedList of ServiceNodes that will get added to the ProvidersStateTable for this Server. |
true
if the Services were added successfully or false
upon error. bool AddProvidersStateTableToRequest | ( | const ProvidersStateTable * | providers_p, |
json_t * | req_p | ||
) |
Add the details to a json request to get the list of all available Services on a Server making sure not to duplicate any Server-Service pairs stored within a given ProvidersStateTable.
providers_p | The ProvidersStateTable detailing all of the Server-Service pairs already processed. |
req_p | The json request to add the details to. |
true
if the ProvidersStateTable details were added to the given request successfully, false
otherwise. bool InitProvidersStateTableFromRequest | ( | ProvidersStateTable *const | providers_p, |
const json_t *const | req_p | ||
) |
Add the details from a json request to a given ProvidersStateTable.
providers_p | The ProvidersStateTable to initialise. |
req_p | The json request to extract the Server-Service details from and add to the given ProvidersStateTable. |
true
if the ProvidersStateTable was initialised successfully, false
otherwise. bool ClearProvidersStateTable | ( | ProvidersStateTable * | providers_p | ) |
Clear all of the servers and services that are being tracked within a ProvidersStateTable.
providers_p | The ProvidersStateTable to clear. |
true
if the ProvidersStateTable was cleared successfully, false
otherwise. bool ReinitProvidersStateTable | ( | ProvidersStateTable * | providers_p, |
const json_t *const | req_p, | ||
const char * | server_uri_s, | ||
const char * | service_name_s | ||
) |
Clear a given ProvidersStateTable and add the details from a json request and a given Server-Service pair to it.
providers_p | The ProvidersStateTable to reinitialise. |
req_p | The json request to extract the Server-Service details from and add to the given ProvidersStateTable. |
server_uri_s | The unique identifier for a server. The URI for the server is used. |
service_name_s | The name of the service to add. |
true
if the ProvidersStateTable was reinitialised successfully, false
otherwise.