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 ServiceJobs. More...
#include <jobs_manager.h>
Public Member Functions | |
struct JobsManager * | GetJobsManager (GrassrootsServer *grassroots_p) |
Get the current Server-wide JobsManager. More... | |
void | InitJobsManager (JobsManager *manager_p, bool(*add_job_fn)(JobsManager *manager_p, uuid_t job_key, ServiceJob *job_p), ServiceJob *(*get_job_fn)(JobsManager *manager_p, const uuid_t key), ServiceJob *(*remove_job_fn)(JobsManager *manager_p, const uuid_t key, bool get_job_flag), LinkedList *(*get_all_jobs_fn)(struct JobsManager *manager_p), bool(*delete_manager_fn)(struct JobsManager *manager_p)) |
Initialise a JobsManager. More... | |
bool | FreeJobsManager (JobsManager *manager_p) |
Free a JobsManager. More... | |
bool | AddServiceJobToJobsManager (JobsManager *manager_p, uuid_t job_key, ServiceJob *job_p) |
Add a ServiceJob to the JobsManager. More... | |
ServiceJob * | GetServiceJobFromJobsManager (JobsManager *manager_p, const uuid_t key) |
Find a ServiceJob. More... | |
ServiceJob * | RemoveServiceJobFromJobsManager (JobsManager *manager_p, const uuid_t key, bool get_job_flag) |
Remove a ServiceJob. More... | |
LinkedList * | GetAllServiceJobsFromJobsManager (struct JobsManager *manager_p) |
Get all ServiceJobs. More... | |
JobsManager * | LoadJobsManager (const char *jobs_manager_s, struct GrassrootsServer *server_p) |
Load and create a JobsManager from the named plugin. More... | |
Data Fields | |
struct Plugin * | jm_plugin_p |
The plugin that thjis JobsManager was loaded from. More... | |
bool(* | jm_add_job_fn )(struct JobsManager *manager_p, uuid_t job_key, ServiceJob *job_p) |
Add a ServiceJob to the JobsManager. More... | |
ServiceJob *(* | jm_get_job_fn )(struct JobsManager *manager_p, const uuid_t key) |
Find a ServiceJob. More... | |
ServiceJob *(* | jm_remove_job_fn )(struct JobsManager *manager_p, const uuid_t key, bool get_job_flag) |
Remove a ServiceJob. More... | |
LinkedList *(* | jm_get_all_jobs_fn )(struct JobsManager *manager_p) |
Get all ServiceJobs. More... | |
bool(* | jm_delete_manager_fn )(struct JobsManager *manager_p) |
The function to use to delete this JobsManager,. More... | |
A datatype for monitoring ServiceJobs.
A JobsManager is used to store details of the ServiceJobs that are currently running on a Server. ServiceJobs can be added, removed and searched for.
struct JobsManager * GetJobsManager | ( | GrassrootsServer * | grassroots_p | ) |
Get the current Server-wide JobsManager.
void InitJobsManager | ( | JobsManager * | manager_p, |
bool(*)(JobsManager *manager_p, uuid_t job_key, ServiceJob *job_p) | add_job_fn, | ||
ServiceJob *(*)(JobsManager *manager_p, const uuid_t key) | get_job_fn, | ||
ServiceJob *(*)(JobsManager *manager_p, const uuid_t key, bool get_job_flag) | remove_job_fn, | ||
LinkedList *(*)(struct JobsManager *manager_p) | get_all_jobs_fn, | ||
bool(*)(struct JobsManager *manager_p) | delete_manager_fn | ||
) |
Initialise a JobsManager.
Set up the callback functions for a given JobsManager.
manager_p | The JobsManager to set up. |
add_job_fn | The callback function to set for jm_add_job_fn for the given JobsManager. |
get_job_fn | The callback function to set for jm_get_job_fn for the given JobsManager. |
remove_job_fn | The callback function to set for jm_remove_job_fn for the given JobsManager. |
get_all_jobs_fn | The callback function to set for jm_get_all_jobs_fn for the given JobsManager. |
delete_manager_fn | The callback function to set for jm_delete_manager_fn for the given JobsManager. |
bool FreeJobsManager | ( | JobsManager * | manager_p | ) |
Free a JobsManager.
manager_p | manager_p The JobsManager to free. |
true
if the JobsManager was freed successfully, false
otherwise bool AddServiceJobToJobsManager | ( | JobsManager * | manager_p, |
uuid_t | job_key, | ||
ServiceJob * | job_p | ||
) |
Add a ServiceJob to the JobsManager.
This is simply a convenience wrapper around jm_add_job_fn for the given JobsManager.
manager_p | The JobsManager to add the ServiceJob to. |
job_key | The uuid_t for the ServiceJob to search for. |
job_p | The ServiceJob to add. |
true
if the ServiceJob was added successfully, false
otherwise.ServiceJob * GetServiceJobFromJobsManager | ( | JobsManager * | manager_p, |
const uuid_t | key | ||
) |
Find a ServiceJob.
Get a previously-added ServiceJob. This is simply a convenience wrapper around jm_get_job_fn for the given JobsManager.
manager_p | The JobsManager to search on. |
key | The uuid_t for the ServiceJob to search for. |
NULL
if it could not be found.ServiceJob * RemoveServiceJobFromJobsManager | ( | JobsManager * | manager_p, |
const uuid_t | key, | ||
bool | get_job_flag | ||
) |
Remove a ServiceJob.
Remove a previously-added ServiceJob from the JobsManager. This is simply a convenience wrapper around jm_remove_job_fn for the given JobsManager.
manager_p | The JobsManager to search on. |
key | The uuid_t for the ServiceJob to search for. |
get_job_flag | If this is true , then the removed ServiceJob will be returned. If this is false then the ServiceJob will not be returned. |
NULL
if it could not be found or get_job_flag is false.LinkedList * GetAllServiceJobsFromJobsManager | ( | struct JobsManager * | manager_p | ) |
Get all ServiceJobs.
Get a LinkedList of ServiceJobs that are currently stored in the JobsManager.
manager_p | The JobsManager to get the ServiceJobs from. |
NULL
if there are not any. JobsManager * LoadJobsManager | ( | const char * | jobs_manager_s, |
struct GrassrootsServer * | server_p | ||
) |
Load and create a JobsManager from the named plugin.
jobs_manager_s | The name of the plugin to use to create the JobsManager. For instance if you wish to load libmy_jobs.so on a Unix platform, the value to use would be "my_jobs" |
NULL
upon error. struct Plugin* jm_plugin_p |
The plugin that thjis JobsManager was loaded from.
bool(* jm_add_job_fn) (struct JobsManager *manager_p, uuid_t job_key, ServiceJob *job_p) |
Add a ServiceJob to the JobsManager.
manager_p | The JobsManager to add the ServiceJob to. |
job_key | The uuid_t for the ServiceJob to search for. |
job_p | The json_t representing the ServiceJob to add. |
true
if the ServiceJob was added successfully, false
otherwise.ServiceJob*(* jm_get_job_fn) (struct JobsManager *manager_p, const uuid_t key) |
Find a ServiceJob.
Get a previously-added ServiceJob.
manager_p | The JobsManager to search on. |
key | The uuid_t for the ServiceJob to search for. |
NULL
if it could not be found.ServiceJob*(* jm_remove_job_fn) (struct JobsManager *manager_p, const uuid_t key, bool get_job_flag) |
Remove a ServiceJob.
Remove a previously-added ServiceJob from the JobsManager.
manager_p | The JobsManager to search on. |
key | The uuid_t for the ServiceJob to search for. |
get_job_flag | If this is true then the removed ServiceJon will be returned if possible. If this is false , then NULL will be returned. |
NULL
, depending upon get_job_flag.LinkedList*(* jm_get_all_jobs_fn) (struct JobsManager *manager_p) |
Get all ServiceJobs.
Get a LinkedList of ServiceJobs that are currently stored in the JobsManager.
manager_p | The JobsManager to get the ServiceJobs from. |
NULL
if there are not any. bool(* jm_delete_manager_fn) (struct JobsManager *manager_p) |
The function to use to delete this JobsManager,.
manager_p | The JobsManager to delete |
true
if the JobsManager was freed successfullly, false
otherwise.