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.
|
A datatype for monitoring ExternalServers. More...
#include <servers_manager.h>
A datatype for monitoring ExternalServers.
A ServersManager is used to store details of the ExternalServers that are currently running on a Server. ExternalServers can be added, removed and searched for.
void InitServersManager | ( | ServersManager * | manager_p, |
int(*)(ServersManager *manager_p, ExternalServer *server_p, ExternalServerSerialiser serialise_fn) | add_server_fn, | ||
ExternalServer *(*)(ServersManager *manager_p, const char *const server_uri_s, ExternalServerDeserialiser deserialise_fn) | get_server_fn, | ||
ExternalServer *(*)(ServersManager *manager_p, const char *const server_uri_s, ExternalServerDeserialiser deserialise_fn) | remove_server_fn, | ||
LinkedList *(*)(struct ServersManager *manager_p, ExternalServerDeserialiser deserialise_fn) | get_all_servers_fn, | ||
void(*)(struct ServersManager *manager_p) | free_servers_manager_fn | ||
) |
Initialise a ServersManager.
Set up the callback functions for a given ServersManager.
manager_p | The ServersManager to set up. |
add_server_fn | The callback function to set for sm_add_server_fn for the given ServersManager. |
get_server_fn | The callback function to set for sm_get_server_fn for the given ServersManager. |
remove_server_fn | The callback function to set for sm_remove_server_fn for the given ServersManager. |
get_all_servers_fn | The callback function to set for sm_get_all_servers_fn for the given ServersManager. |
free_servers_manager_fn | The callback function to set for sm_free_servers_manager_fn for the given ServersManager. |
int AddExternalServerToServersManager | ( | ServersManager * | manager_p, |
ExternalServer * | server_p, | ||
ExternalServerSerialiser | serialise_fn | ||
) |
Add an ExternalServer to the ServersManager.
manager_p | The ServersManager to add the ExternalServer to. |
server_p | The ExternalServer to add. |
serialise_fn | The function used to serialise the ExternalServer into the unsigned char array which is the value stored in the ServersManager. If this is NULL then SerialiseExternalServerToJSON is used by default. |
ExternalServer * GetExternalServerFromServersManager | ( | ServersManager * | manager_p, |
const char *const | server_uri_s, | ||
ExternalServerDeserialiser | deserialise_fn | ||
) |
Find a ExternalServer.
Get a previously-added ExternalServer. This is simply a convenience wrapper around sm_get_server_fn for the given ServersManager.
manager_p | The ServersManager to search on. |
server_uri_s | The uri for the ExternalServer to search for. |
deserialise_fn | The function used to deserialise the data stored in this ServersManager to create ExternalServer. If this is NULL then DeserialiseExternalServerFromJSON is used by default. |
NULL
if it could not be found.ExternalServer * RemoveExternalServerFromServersManager | ( | ServersManager * | manager_p, |
const char *const | server_uri_s, | ||
ExternalServerDeserialiser | deserialise_fn | ||
) |
Remove a ExternalServer.
Remove a previously-added ExternalServer from the ServersManager. This is simply a convenience wrapper around sm_remove_server_fn for the given ServersManager.
manager_p | The ServersManager to search on. |
server_uri_s | The uri for the ExternalServer to search for. |
deserialise_fn | The function used to deserialise the data stored in this ServersManager to create ExternalServer. If this is NULL then DeserialiseExternalServerFromJSON is used by default. |
NULL
if it could not be found.LinkedList * GetAllExternalServersFromServersManager | ( | ServersManager * | manager_p, |
ExternalServerDeserialiser | deserialise_fn | ||
) |
Get all ExternalServers.
Get a LinkedList of ExternalServerNodes for all active ExternalServers.
manager_p | The ServersManager to remove the ExternalServer from. |
deserialise_fn | The function used to deserialise the data stored in this ServersManager to create ExternalServer. If this is NULL then DeserialiseExternalServerFromJSON is used by default. |
NULL
if there are not any ExternalServers.void FreeServersManager | ( | ServersManager * | manager_p | ) |
Free a ServersManager.
Free a ServersManager and all of its associated ExternalServers.
manager_p | The ServersManager to free. |
json_t * AddExternalServerOperationsToJSON | ( | ServersManager * | manager_p, |
Operation | op | ||
) |
Get the JSON fragment which will form part of a response to other servers and clients.
representing the capabilities available on for all available ExternalServers for a given Operation.
manager_p | The ServersManager containing the details of all of the ExternalServers. |
op | The Operation to get the available facilities for. |
NULL
upon error. struct Plugin* sm_plugin_p |
The plugin that thjs JobsManager was loaded from.
uuid_t sm_server_id |
The UUID for this Server.
char sm_server_id_s[UUID_STRING_BUFFER_SIZE] |
The UUID of this ExternalServer as a string.
int(* sm_add_server_fn) (struct ServersManager *manager_p, ExternalServer *server_p, ExternalServerSerialiser serialise_fn) |
Add an ExternalServer to the ServersManager.
manager_p | The ServersManager to add the ExternalServer to. |
server_p | The ExternalServer to add. |
serialise_fn | The function used to serialise the ExternalServer into the unsigned char array which is the value stored in the ServersManager. If this is NULL then SerialiseExternalServerToJSON is used by default. |
ExternalServer*(* sm_get_server_fn) (struct ServersManager *manager_p, const char *const server_uri_s, ExternalServerDeserialiser deserialise_fn) |
Find an ExternalServer.
Get a previously-added ExternalServer.
manager_p | The ServersManager to add the ExternalServer to. |
server_uri_s | The uri for the ExternalServer to search for. |
deserialise_fn | The function used to deserialise the data stored in this ServersManager to create ExternalServer. If this is NULL then DeserialiseExternalServerFromJSON is used by default. |
NULL
if it could not be found.ExternalServer*(* sm_remove_server_fn) (struct ServersManager *manager_p, const char *const server_uri_s, ExternalServerDeserialiser deserialise_fn) |
Remove an ExternalServer.
Remove a previously-added ExternalServer.
manager_p | The ServersManager to remove the ExternalServer from. |
server_uri_s | The uri for the ExternalServer to search for. |
deserialise_fn | The function used to deserialise the data stored in this ServersManager to create ExternalServer. If this is NULL then DeserialiseExternalServerFromJSON is used by default. |
NULL
if it could not be found. LinkedList*(* sm_get_all_servers_fn) (struct ServersManager *manager_p, ExternalServerDeserialiser deserialise_fn) |
Get all ExternalServers.
Get a LinkedList of ExternalServerNodes for all active ExternalServers.
manager_p | The ServersManager to remove the ExternalServer from. |
deserialise_fn | The function used to deserialise the data stored in this ServersManager to create ExternalServer. If this is NULL then DeserialiseExternalServerFromJSON is used by default. |
NULL
if there are not any. void(* sm_free_servers_manager_fn) (struct ServersManager *manager_p) |
Free a given ServersManager.
manager_p | This ServersManager. |
LinkedList*(* sm_get_all_matching_servers_fn) (struct ServersManager *manager_p, const char *const local_service_name_s) |
Get a LinkedList of ExternalServerNodes that have a given Service.
manager_p | This ServersManager. |
local_service_name_s | The name of the Service to match. |
NULL
if there are not any.