ServiceJobSet Struct Reference

A datatype to represent a collection of ServiceJobs. More...

#include <service_job.h>

Collaboration diagram for ServiceJobSet:
[legend]

Public Member Functions

ServiceJobNodeFindServiceJobNodeInServiceJobSet (ServiceJobSet *job_set_p, ServiceJob *job_p)
 Find the ServiceJobNode for a given ServiceJob within a ServiceJobSet. More...
 
ServiceJobNodeFindServiceJobNodeByUUIDInServiceJobSet (const ServiceJobSet *job_set_p, const uuid_t job_id)
 Find the ServiceJobNode for a ServiceJob with a given uuid within a ServiceJobSet. More...
 
bool RemoveServiceJobByUUIDFromServiceJobSet (ServiceJobSet *job_set_p, uuid_t job_id)
 Remove a ServiceJob with a given uuid from a ServiceJobSet. More...
 
bool RemoveServiceJobFromServiceJobSet (ServiceJobSet *job_set_p, ServiceJob *job_p)
 Remove a ServiceJob from a ServiceJobSet. More...
 
ServiceJobSetAllocateServiceJobSet (struct Service *service_p)
 Allocate a ServiceJobSet. More...
 
ServiceJobSetAllocateSimpleServiceJobSet (struct Service *service_p, const char *job_name_s, const char *job_description_s)
 Allocate a ServiceJobSet and populate it with a single ServiceJob. More...
 
void FreeServiceJobSet (ServiceJobSet *job_set_p)
 Free a ServiceJobSet. More...
 
ServiceJobGetServiceJobFromServiceJobSetById (const ServiceJobSet *jobs_p, const uuid_t job_id)
 Search a ServiceJobSet for ServiceJob. More...
 
json_t * GetServiceJobSetAsJSON (const ServiceJobSet *jobs_p, bool omit_results_flag)
 Get the json representation of a ServiceJobSet. More...
 
bool ProcessServiceJobSet (ServiceJobSet *jobs_p, json_t *res_p)
 Process all ServiceJobs within a ServiceJobSet. More...
 
ServiceJobGetServiceJobFromServiceJobSet (const ServiceJobSet *jobs_p, const uint32 index)
 Get the ServiceJob at a particular position in a ServiceJobSet. More...
 
uint32 GetServiceJobSetSize (const ServiceJobSet *const jobs_p)
 Get the number of ServiceJobs in a ServiceJobSet. More...
 

Data Fields

struct Servicesjs_service_p
 The Service that is running these jobs. More...
 
LinkedListsjs_jobs_p
 The ServiceJobs that are in use for the Service. More...
 

Detailed Description

A datatype to represent a collection of ServiceJobs.

Examples
long_running_service.c.

Member Function Documentation

◆ FindServiceJobNodeInServiceJobSet()

ServiceJobNode * FindServiceJobNodeInServiceJobSet ( ServiceJobSet job_set_p,
ServiceJob job_p 
)

Find the ServiceJobNode for a given ServiceJob within a ServiceJobSet.

Parameters
job_set_pThe ServiceJobSet to search.
job_pThe ServiceJob to look for.
Returns
The ServiceJobNode that points to the requested ServiceJob or NULL if it could not be found.

◆ FindServiceJobNodeByUUIDInServiceJobSet()

ServiceJobNode * FindServiceJobNodeByUUIDInServiceJobSet ( const ServiceJobSet job_set_p,
const uuid_t  job_id 
)

Find the ServiceJobNode for a ServiceJob with a given uuid within a ServiceJobSet.

Parameters
job_set_pThe ServiceJobSet to search.
job_idThe uuid of the ServiceJob to find.
Returns
The ServiceJobNode that points to the requested ServiceJob or NULL if it could not be found.

◆ RemoveServiceJobByUUIDFromServiceJobSet()

bool RemoveServiceJobByUUIDFromServiceJobSet ( ServiceJobSet job_set_p,
uuid_t  job_id 
)

Remove a ServiceJob with a given uuid from a ServiceJobSet.

The ServiceJob is not deleted, it is just removed from the ServiceJobSet.

Parameters
job_set_pThe ServiceJobSet to remove the given ServiceJob from.
job_idThe uuid of the ServiceJob to remove.
Returns
true if the ServiceJob was removed successfully, false otherwise.
See also
RemoveServiceJobFromServiceJobSet()

◆ RemoveServiceJobFromServiceJobSet()

bool RemoveServiceJobFromServiceJobSet ( ServiceJobSet job_set_p,
ServiceJob job_p 
)

Remove a ServiceJob from a ServiceJobSet.

The ServiceJob is not deleted, it is just removed from the ServiceJobSet.

Parameters
job_set_pThe ServiceJobSet to remove the given ServiceJob from.
job_pThe ServiceJob to remove.
Returns
true if the ServiceJob was removed successfully, false otherwise.

◆ AllocateServiceJobSet()

ServiceJobSet * AllocateServiceJobSet ( struct Service service_p)

Allocate a ServiceJobSet.

Parameters
service_pThe Service to allocate the ServiceJobSet for.
Returns
A newly-allocated ServiceJobSet or NULL upon error.
See also
InitServiceJob
Examples
long_running_service.c.

◆ AllocateSimpleServiceJobSet()

ServiceJobSet * AllocateSimpleServiceJobSet ( struct Service service_p,
const char *  job_name_s,
const char *  job_description_s 
)

Allocate a ServiceJobSet and populate it with a single ServiceJob.

Parameters
service_pThe Service to allocate the ServiceJobSet for.
job_name_sThe name that will be given to the ServiceJob that will be created.
job_description_sThe description that will be given to the ServiceJob that will be created. This can be NULL.
Returns
A newly-allocated ServiceJobSet or NULL upon error.
See also
InitServiceJob

◆ FreeServiceJobSet()

void FreeServiceJobSet ( ServiceJobSet job_set_p)

Free a ServiceJobSet.

Parameters
job_set_pThe ServiceJobSet to free.
Examples
long_running_service.c.

◆ GetServiceJobFromServiceJobSetById()

ServiceJob * GetServiceJobFromServiceJobSetById ( const ServiceJobSet jobs_p,
const uuid_t  job_id 
)

Search a ServiceJobSet for ServiceJob.

Parameters
jobs_pThe ServiceJobSet to search.
job_idThe uuid_t for the ServiceJob to find.
Returns
A pointer to the matching ServiceJob or NULL if it could not be found.

◆ GetServiceJobSetAsJSON()

json_t * GetServiceJobSetAsJSON ( const ServiceJobSet jobs_p,
bool  omit_results_flag 
)

Get the json representation of a ServiceJobSet.

Parameters
jobs_pThe ServiceJobSet to get the representation of.
omit_results_flagIf this is true then just the minimal status information for the ServiceJob will be returned. If it is false then the job results will be included too if possible.
Returns
The json_t representing the ServiceJobSet or NULL upon error.

◆ ProcessServiceJobSet()

bool ProcessServiceJobSet ( ServiceJobSet jobs_p,
json_t *  res_p 
)

Process all ServiceJobs within a ServiceJobSet.

Each ServiceJob will have its status checked and updated if necessary along with setting up any LinkedServices if available.

Parameters
jobs_pThe ServiceJobSet to process.
res_pThe JSON array where are any results will get appended.
Returns
true if all ServiceJobs within the ServiceJobSet were processed successfully, false otherwise.

◆ GetServiceJobFromServiceJobSet()

ServiceJob * GetServiceJobFromServiceJobSet ( const ServiceJobSet jobs_p,
const uint32  index 
)

Get the ServiceJob at a particular position in a ServiceJobSet.

Parameters
jobs_pThe ServiceJobSet to get the ServiceJob from.
indexThe index of the ServiceJob to get.
Returns
The ServiceJob or NULL if there was an error such as if the index was out of range.

◆ GetServiceJobSetSize()

uint32 GetServiceJobSetSize ( const ServiceJobSet *const  jobs_p)

Get the number of ServiceJobs in a ServiceJobSet.

Parameters
jobs_pThe ServiceJobSet to get size of.
Returns
The number of ServiceJobs in this ServiceJobSet.

Field Documentation

◆ sjs_service_p

struct Service* sjs_service_p

The Service that is running these jobs.

◆ sjs_jobs_p

LinkedList* sjs_jobs_p

The ServiceJobs that are in use for the Service.


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