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.
JobsManager Struct Reference

A datatype for monitoring ServiceJobs. More...

#include <jobs_manager.h>

Collaboration diagram for JobsManager:
[legend]

Public Member Functions

struct JobsManagerGetJobsManager (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...
 
ServiceJobGetServiceJobFromJobsManager (JobsManager *manager_p, const uuid_t key)
 Find a ServiceJob. More...
 
ServiceJobRemoveServiceJobFromJobsManager (JobsManager *manager_p, const uuid_t key, bool get_job_flag)
 Remove a ServiceJob. More...
 
LinkedListGetAllServiceJobsFromJobsManager (struct JobsManager *manager_p)
 Get all ServiceJobs. More...
 
JobsManagerLoadJobsManager (const char *jobs_manager_s, struct GrassrootsServer *server_p)
 Load and create a JobsManager from the named plugin. More...
 

Data Fields

struct Pluginjm_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...
 

Detailed Description

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.

Member Function Documentation

◆ GetJobsManager()

struct JobsManager * GetJobsManager ( GrassrootsServer grassroots_p)

Get the current Server-wide JobsManager.

Returns
The JobsManager.

◆ InitJobsManager()

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.

Parameters
manager_pThe JobsManager to set up.
add_job_fnThe callback function to set for jm_add_job_fn for the given JobsManager.
get_job_fnThe callback function to set for jm_get_job_fn for the given JobsManager.
remove_job_fnThe callback function to set for jm_remove_job_fn for the given JobsManager.
get_all_jobs_fnThe callback function to set for jm_get_all_jobs_fn for the given JobsManager.
delete_manager_fnThe callback function to set for jm_delete_manager_fn for the given JobsManager.

◆ FreeJobsManager()

bool FreeJobsManager ( JobsManager manager_p)

Free a JobsManager.

Parameters
manager_pmanager_p The JobsManager to free.
Returns
true if the JobsManager was freed successfully, false otherwise

◆ AddServiceJobToJobsManager()

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.

Parameters
manager_pThe JobsManager to add the ServiceJob to.
job_keyThe uuid_t for the ServiceJob to search for.
job_pThe ServiceJob to add.
Returns
true if the ServiceJob was added successfully, false otherwise.
See also
jm_add_job_fn

◆ GetServiceJobFromJobsManager()

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.

Parameters
manager_pThe JobsManager to search on.
keyThe uuid_t for the ServiceJob to search for.
Returns
A ServiceJob for the matching ServiceJob or NULL if it could not be found.
See also
jm_get_job_fn

◆ RemoveServiceJobFromJobsManager()

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.

Parameters
manager_pThe JobsManager to search on.
keyThe uuid_t for the ServiceJob to search for.
get_job_flagIf this is true, then the removed ServiceJob will be returned. If this is false then the ServiceJob will not be returned.
Returns
A ServiceJob for the matching ServiceJob if get_job_flag is set to true or NULL if it could not be found or get_job_flag is false.
See also
jm_remove_job_fn

◆ GetAllServiceJobsFromJobsManager()

LinkedList * GetAllServiceJobsFromJobsManager ( struct JobsManager manager_p)

Get all ServiceJobs.

Get a LinkedList of ServiceJobs that are currently stored in the JobsManager.

Parameters
manager_pThe JobsManager to get the ServiceJobs from.
Returns
A LinkedList of ServiceJobNodes of all of the ServiceJobs or NULL if there are not any.
See also
GetAllServiceJobsFromJobsManager
jm_get_all_jobs_fn

◆ LoadJobsManager()

JobsManager * LoadJobsManager ( const char *  jobs_manager_s,
struct GrassrootsServer server_p 
)

Load and create a JobsManager from the named plugin.

Parameters
jobs_manager_sThe 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"
Returns
The loaded JobsManager or NULL upon error.

Field Documentation

◆ jm_plugin_p

struct Plugin* jm_plugin_p

The plugin that thjis JobsManager was loaded from.

◆ jm_add_job_fn

bool(* jm_add_job_fn) (struct JobsManager *manager_p, uuid_t job_key, ServiceJob *job_p)

Add a ServiceJob to the JobsManager.

Parameters
manager_pThe JobsManager to add the ServiceJob to.
job_keyThe uuid_t for the ServiceJob to search for.
job_pThe json_t representing the ServiceJob to add.
Returns
true if the ServiceJob was added successfully, false otherwise.
See also
AddServiceJobToJobsManager

◆ jm_get_job_fn

ServiceJob*(* jm_get_job_fn) (struct JobsManager *manager_p, const uuid_t key)

Find a ServiceJob.

Get a previously-added ServiceJob.

Parameters
manager_pThe JobsManager to search on.
keyThe uuid_t for the ServiceJob to search for.
Returns
A json_t for the matching ServiceJob or NULL if it could not be found.
See also
GetServiceJobFromJobsManager

◆ jm_remove_job_fn

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.

Parameters
manager_pThe JobsManager to search on.
keyThe uuid_t for the ServiceJob to search for.
get_job_flagIf this is true then the removed ServiceJon will be returned if possible. If this is false, then NULL will be returned.
Returns
The removed ServiceJob or NULL, depending upon get_job_flag.
See also
RemoveServiceJobFromJobsManager

◆ jm_get_all_jobs_fn

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.

Parameters
manager_pThe JobsManager to get the ServiceJobs from.
Returns
A LinkedList of ServiceJobNodes of all of the ServiceJobs or NULL if there are not any.
See also
GetAllServiceJobsFromJobsManager

◆ jm_delete_manager_fn

bool(* jm_delete_manager_fn) (struct JobsManager *manager_p)

The function to use to delete this JobsManager,.

Parameters
manager_pThe JobsManager to delete
Returns
true if the JobsManager was freed successfullly, false otherwise.

The documentation for this struct was generated from the following files: