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.
|
Shared code specific for Servers. More...
Data Structures | |
struct | JobsManager |
A datatype for monitoring ServiceJobs. More... | |
struct | ExternalServer |
A datatype to allow access to an external Grassroots Server. More... | |
struct | ExternalServerNode |
A datatype for storing ExternalServers in a LinkedList. More... | |
struct | ServersManager |
A datatype for monitoring ExternalServers. More... | |
Typedefs | |
typedef unsigned char *(* | ServiceJobSerialiser) (ServiceJob *job_p, uint32 *length_p) |
A typedef'd function for serialising a ServiceJob into an array of raw bytes. More... | |
typedef ServiceJob *(* | ServiceJobDeserialiser) (unsigned char *input_data_p, void *config_p) |
A typedef'd function for deserialising a ServiceJob from an array of raw bytes. More... | |
typedef ExternalServer *(* | ExternalServerDeserialiser) (const unsigned char *data_p) |
A function to take a raw binary data representation of a previously stored ExternalServer and recreate it. More... | |
typedef unsigned char *(* | ExternalServerSerialiser) (ExternalServer *server_p, uint32 *length_p) |
A function to generate a raw binary data representation of a ExternalServer allowing it to be recreated at a later time. More... | |
Functions | |
bool | InitMongoDB (void) |
When the Grassroots system starts up, iniitialise and global MongoDB resources that it needs. More... | |
void | ExitMongoDB (void) |
Free any MongoDB resources that the Grassroots system obtained when it was started. More... | |
bool | InitDrmaaEnvironment (void) |
Get any DRMAA environment resources, if required, when starting the Grassroots Server. More... | |
bool | ExitDrmaaEnvironment (void) |
Release any DRMAA environment resources, if required, when shutting down the Grassroots Server. More... | |
void | ConnectToExternalServers (GrassrootsServer *server_p) |
Connect to any defined separate Grassroots servers. More... | |
GRASSROOTS_SERVICE_MANAGER_LOCAL void | DisconnectFromExternalServers (GrassrootsServer *server_p) |
Disconnect to any defined separate Grassroots servers. More... | |
const char * | GetServerProviderName (const GrassrootsServer *grassroots_p) |
Get the Provider name for this Grassroots Server. More... | |
const char * | GetServerProviderDescription (const GrassrootsServer *grassroots_p) |
Get the Provider description for this Grassroots Server. More... | |
const char * | GetServerProviderURI (const GrassrootsServer *grassroots_p) |
Get the Provider URI for this Grassroots Server. More... | |
const json_t * | GetProviderAsJSON (const GrassrootsServer *grassroots_p) |
Get the JSON fragment with all of the details of the Provider for this Grassroots Server. More... | |
bool | IsServiceEnabled (const GrassrootsServer *grassroots_p, const char *service_name_s) |
Check if a named Service is enabled upon this Grassroots server. More... | |
const char * | GetJobLoggingURI (const GrassrootsServer *grassroots_p) |
Get the job logging URI for this Grassroots Server. More... | |
uuid_t * | GetLocalServerId (struct GrassrootsServer *grassroots_p) |
Get the current Server uuid. More... | |
const char * | GetLocalServerIdAsString (struct GrassrootsServer *grassroots_p) |
Get the current Server uuid as a c-style string. More... | |
bool | InitInformationSystem (void) |
Initialise the various base components of the Grassroots system. More... | |
bool | DestroyInformationSystem (void) |
Perform any pre-termination tasks of the Grassroots system prior to it exiting. More... | |
GrassrootsServer * | AllocateGrassrootsServer (const char *grassroots_path_s, const char *config_filename_s, const char *service_config_path_s, const char *services_path_s, const char *references_path_s, const char *jobs_managers_path_s, const char *servers_managers_path_s, struct JobsManager *external_jobs_manager_p, MEM_FLAG jobs_manager_flag, struct ServersManager *external_servers_manager_p, MEM_FLAG servers_manager_flag) |
Allocate a GrassrootsServer. More... | |
void | FreeGrassrootsServer (GrassrootsServer *server_p) |
Free a GrassrootsServer. More... | |
json_t * | ProcessServerJSONMessage (GrassrootsServer *grassroots_p, json_t *json_req_p, User *user_p, const char **error_ss) |
Process a given JSON request and produce the server response. More... | |
json_t * | GetInitialisedResponseOnServer (GrassrootsServer *server_p, User *user_p, const json_t *req_p, const char *key_s, json_t *value_p) |
Create a response object with a valid header and a given key and value. More... | |
json_t * | GetGlobalConfigValue (const GrassrootsServer *grassroots_p, const char *key_s) |
Get a configuration value from the global Grassroots configuration file. More... | |
struct ServersManager * | GetServersManager (GrassrootsServer *server_p) |
Get the ServersManager for a given GrassrootsServer. More... | |
json_t * | GetGlobalServiceConfig (GrassrootsServer *grassroots_p, const char *const service_name_s, bool *alloc_flag_p) |
Get a configuration value for a named Service. More... | |
Shared code specific for Servers.
typedef unsigned char*(* ServiceJobSerialiser) (ServiceJob *job_p, uint32 *length_p) |
A typedef'd function for serialising a ServiceJob into an array of raw bytes.
job_p | The ServiceJob to serialise. |
length_p | If the serialisation is successful, the length of the resultant array will be stored here. |
NULL
upon error. typedef ServiceJob*(* ServiceJobDeserialiser) (unsigned char *input_data_p, void *config_p) |
A typedef'd function for deserialising a ServiceJob from an array of raw bytes.
input_data_p | The array of raw bytes from a previously serialised ServiceJob. |
config_p | If the ServiceJobDeserialiser requires some configuration data, it can be passed in here. This can be NULL . |
NULL
upon error. typedef ExternalServer*(* ExternalServerDeserialiser) (const unsigned char *data_p) |
A function to take a raw binary data representation of a previously stored ExternalServer and recreate it.
data_p | The raw binary data representation of the ExternalServer. |
NULL
upon error. typedef unsigned char*(* ExternalServerSerialiser) (ExternalServer *server_p, uint32 *length_p) |
A function to generate a raw binary data representation of a ExternalServer allowing it to be recreated at a later time.
server_p | The ExternalServer to generate the representation for. |
length_p | Upon success, the length of the generated binary data stream will be stored here. |
NULL
upon error. bool InitMongoDB | ( | void | ) |
When the Grassroots system starts up, iniitialise and global MongoDB resources that it needs.
true
if the global MongoDB resources were acquired successfully, false
otherwise. void ExitMongoDB | ( | void | ) |
Free any MongoDB resources that the Grassroots system obtained when it was started.
bool InitDrmaaEnvironment | ( | void | ) |
Get any DRMAA environment resources, if required, when starting the Grassroots Server.
true
if the DRMAA environment was started up successfully, false
otherwise. bool ExitDrmaaEnvironment | ( | void | ) |
Release any DRMAA environment resources, if required, when shutting down the Grassroots Server.
true
if the DRMAA environment was started up successfully, false
otherwise. void ConnectToExternalServers | ( | GrassrootsServer * | server_p | ) |
Connect to any defined separate Grassroots servers.
GRASSROOTS_SERVICE_MANAGER_LOCAL void DisconnectFromExternalServers | ( | GrassrootsServer * | server_p | ) |
Disconnect to any defined separate Grassroots servers.
const char* GetServerProviderName | ( | const GrassrootsServer * | grassroots_p | ) |
Get the Provider name for this Grassroots Server.
const char* GetServerProviderDescription | ( | const GrassrootsServer * | grassroots_p | ) |
Get the Provider description for this Grassroots Server.
const char* GetServerProviderURI | ( | const GrassrootsServer * | grassroots_p | ) |
Get the Provider URI for this Grassroots Server.
const json_t* GetProviderAsJSON | ( | const GrassrootsServer * | grassroots_p | ) |
Get the JSON fragment with all of the details of the Provider for this Grassroots Server.
NULL
upon error. bool IsServiceEnabled | ( | const GrassrootsServer * | grassroots_p, |
const char * | service_name_s | ||
) |
const char* GetJobLoggingURI | ( | const GrassrootsServer * | grassroots_p | ) |
Get the job logging URI for this Grassroots Server.
uuid_t* GetLocalServerId | ( | struct GrassrootsServer * | grassroots_p | ) |
Get the current Server uuid.
const char* GetLocalServerIdAsString | ( | struct GrassrootsServer * | grassroots_p | ) |
Get the current Server uuid as a c-style string.
bool InitInformationSystem | ( | void | ) |
Initialise the various base components of the Grassroots system.
true
if the system was successfully initialised, false
otherwise. bool DestroyInformationSystem | ( | void | ) |
Perform any pre-termination tasks of the Grassroots system prior to it exiting.
true
if the tasks were successfully completed, false
otherwise. GrassrootsServer * AllocateGrassrootsServer | ( | const char * | grassroots_path_s, |
const char * | config_filename_s, | ||
const char * | service_config_path_s, | ||
const char * | services_path_s, | ||
const char * | references_path_s, | ||
const char * | jobs_managers_path_s, | ||
const char * | servers_managers_path_s, | ||
struct JobsManager * | external_jobs_manager_p, | ||
MEM_FLAG | jobs_manager_flag, | ||
struct ServersManager * | external_servers_manager_p, | ||
MEM_FLAG | servers_manager_flag | ||
) |
Allocate a GrassrootsServer.
NULL
upon error. void FreeGrassrootsServer | ( | GrassrootsServer * | server_p | ) |
Free a GrassrootsServer.
server_p | The GrassrootsServer to free. |
json_t * ProcessServerJSONMessage | ( | GrassrootsServer * | grassroots_p, |
json_t * | json_req_p, | ||
User * | user_p, | ||
const char ** | error_ss | ||
) |
Process a given JSON request and produce the server response.
server_p | The GrassrootsServer that will process the request. |
req_p | The incoming JSON request. |
user_p | The user accessing Grassroots. This can be NULL for a public or non-logged in user. |
error_ss | A pointer to a variable where any error messages can be stored. |
NULL
upon error. json_t * GetInitialisedResponseOnServer | ( | GrassrootsServer * | server_p, |
User * | user_p, | ||
const json_t * | req_p, | ||
const char * | key_s, | ||
json_t * | value_p | ||
) |
Create a response object with a valid header and a given key and value.
server_p | The GrassrootsServer that will process the request. |
req_p | If this object is not NULL and contains a "verbose" key set to true, then the request will be added to a "request" key within the "header" section of this response. This is to allow the tracking of requests to responses if needed. |
key_s | The key to use to add the associated value to the generated response. |
value_p | The value to add to the generated response. |
NULL
upon error. json_t * GetGlobalConfigValue | ( | const GrassrootsServer * | grassroots_p, |
const char * | key_s | ||
) |
Get a configuration value from the global Grassroots configuration file.
key_s | The key to get the associated value for. |
NULL
if it could not be found. struct ServersManager * GetServersManager | ( | GrassrootsServer * | server_p | ) |
Get the ServersManager for a given GrassrootsServer.
server_p | The GrassrootsServer to get the ServersManager from. |
json_t * GetGlobalServiceConfig | ( | GrassrootsServer * | grassroots_p, |
const char *const | service_name_s, | ||
bool * | alloc_flag_p | ||
) |
Get a configuration value for a named Service.
The system will initially check the "config/<service_name>" folder within the Grassroots directory e.g. "config/BlastN Service" for the Service called "BlastN Service". If this file exists it will be loaded and produce the configuration value. If it does not exist or cannot be loaded then, the system will attempt to use an object specified at "services.<service_name>" in the global configuration file instead.
service_name_s | The name of the Service to get the configuration data for. |
alloc_flag_p | If the returned JSON fragment has been newly-allocated then the value that this points to will be set to true to indicate that the returned value will need to have json_decref called upon it to avoid a memory leak. |
NULL
if it could not be loaded.