ARC SDK
Public Member Functions | Static Public Attributes | Protected Attributes
Arc::JobInformationStorage Class Referenceabstract

Abstract class for storing job information. More...

#include <arc/compute/Job.h>

Inheritance diagram for Arc::JobInformationStorage:
Arc::JobInformationStorageBDB Arc::JobInformationStorageSQLite Arc::JobInformationStorageXML

Public Member Functions

 JobInformationStorage (const std::string &name, unsigned nTries=10, unsigned tryInterval=500000)
 Constructor. More...
 
bool IsValid () const
 Check if storage is valid. More...
 
bool IsStorageExisting () const
 Check if storage exists. More...
 
virtual bool ReadAll (std::list< Job > &jobs, const std::list< std::string > &rejectEndpoints=std::list< std::string >())=0
 Read all jobs from storage. More...
 
virtual bool Read (std::list< Job > &jobs, std::list< std::string > &jobIdentifiers, const std::list< std::string > &endpoints=std::list< std::string >(), const std::list< std::string > &rejectEndpoints=std::list< std::string >())=0
 Read specified jobs. More...
 
virtual bool Write (const std::list< Job > &jobs)
 Write jobs. More...
 
virtual bool Write (const std::list< Job > &jobs, const std::set< std::string > &prunedServices, std::list< const Job *> &newJobs)=0
 Write jobs. More...
 
virtual bool Clean ()=0
 Clean storage. More...
 
virtual bool Remove (const std::list< std::string > &jobids)=0
 Remove jobs. More...
 
const std::string & GetName () const
 Get name. More...
 

Static Public Attributes

static JobInformationStorageDescriptor AVAILABLE_TYPES []
 

Protected Attributes

const std::string name
 
unsigned nTries
 
unsigned tryInterval
 
bool isValid
 
bool isStorageExisting
 

Detailed Description

Abstract class for storing job information.

This abstract class provides an interface which can be used to store job information, which can then later be used to initialise Job objects from.

Note
This class is abstract. All functionality is provided by specialised child classes.

Constructor & Destructor Documentation

◆ JobInformationStorage()

Arc::JobInformationStorage::JobInformationStorage ( const std::string &  name,
unsigned  nTries = 10,
unsigned  tryInterval = 500000 
)
inline

Constructor.

Construct a JobInformationStorage object with name name. The name could be a file name or maybe a database, that is implemention specific. The nTries argument specifies the number times a lock on the storage should be tried obtained for each method invocation. The constructor it self should not acquire a lock through-out the object lifetime. tryInterval is the waiting period in micro seconds between each locking attemp.

Parameters
namename of the storage.
nTriesspecifies the maximal number of times try to acquire a lock on storage to read from.
tryIntervalspecifies the interval (in micro seconds) between each attempt to acquire a lock.

Member Function Documentation

◆ Clean()

virtual bool Arc::JobInformationStorage::Clean ( )
pure virtual

Clean storage.

Invoking this method causes the storage to be cleaned of any jobs it holds.

Note
This method is abstract and an implementation must be provided by specialised classes.
Returns
true is returned if the storage was successfully cleaned, otherwise false is returned.

Implemented in Arc::JobInformationStorageBDB, Arc::JobInformationStorageSQLite, and Arc::JobInformationStorageXML.

◆ GetName()

const std::string& Arc::JobInformationStorage::GetName ( ) const
inline

Get name.

Returns
Returns the name of the storage.

◆ IsStorageExisting()

bool Arc::JobInformationStorage::IsStorageExisting ( ) const
inline

Check if storage exists.

Returns
true if storage already exist.

◆ IsValid()

bool Arc::JobInformationStorage::IsValid ( void  ) const
inline

Check if storage is valid.

Returns
true if storage is valid.

◆ Read()

virtual bool Arc::JobInformationStorage::Read ( std::list< Job > &  jobs,
std::list< std::string > &  jobIdentifiers,
const std::list< std::string > &  endpoints = std::list< std::string >(),
const std::list< std::string > &  rejectEndpoints = std::list< std::string >() 
)
pure virtual

Read specified jobs.

Read jobs specified by job identifiers and/or endpoints from storage. Only jobs which has a JobID or a Name attribute matching any of the items in the identifiers list parameter, and also jobs for which the JobManagementURL attribute matches any of those endpoints specified in the endpoints list parameter, will be added to the list of Job objects reference to by the jobs parameter, except those jobs for which the JobManagementURL attribute matches any of those endpoints specified in the rejectEndpoints list parameter. Identifiers specified in the jobIdentifiers list parameter which matches a job in the storage will be removed from the referenced list. The algorithm used for matching should be equivalent to that used in the URL::StringMatches method.

Note
This method is abstract and an implementation must be provided by specialised classes.
Parameters
jobsreference to list of Job objects which will be filled with matching jobs.
jobIdentifiersspecifies the job IDs and names of jobs to be added to the job list. Entries in this list is removed if they match a job from the storage.
endpointsis a list of strings specifying endpoints for which Job objects with the JobManagementURL attribute matching any of those endpoints will added to the job list. The algorithm used for matching should be equivalent to that used in the URL::StringMatches method.
rejectEndpointsis a list of strings specifying endpoints for which Job objects with the JobManagementURL attribute matching any of those endpoints will not be part of the retrieved jobs. The algorithm used for matching should be equivalent to that used in the URL::StringMatches method.
Returns
false is returned in case a job failed to be read from storage, otherwise true is returned. This method will also return in case an identifier does not match any jobs in the storage.

Implemented in Arc::JobInformationStorageBDB, Arc::JobInformationStorageSQLite, and Arc::JobInformationStorageXML.

◆ ReadAll()

virtual bool Arc::JobInformationStorage::ReadAll ( std::list< Job > &  jobs,
const std::list< std::string > &  rejectEndpoints = std::list< std::string >() 
)
pure virtual

Read all jobs from storage.

Read all jobs contained in storage, except those managed by a service at an endpoint which matches any of those in the rejectEndpoints list parameter. The read jobs are added to the list of Job objects referenced by the jobs parameter. The algorithm used for matching should be equivalent to that used in the URL::StringMatches method.

Note
This method is abstract and an implementation must be provided by specialised classes.
Parameters
jobsis a reference to a list of Job objects, which will be filled with the jobs read from storage (cleared before use).
rejectEndpointsis a list of strings specifying endpoints for which Job objects with JobManagementURL matching any of those endpoints will not be part of the retrieved jobs. The algorithm used for matching should be equivalent to that used in the URL::StringMatches method.
Returns
true is returned if all jobs contained in the storage was retrieved (except those rejected, if any), otherwise false.

Implemented in Arc::JobInformationStorageBDB, Arc::JobInformationStorageSQLite, and Arc::JobInformationStorageXML.

◆ Remove()

virtual bool Arc::JobInformationStorage::Remove ( const std::list< std::string > &  jobids)
pure virtual

Remove jobs.

The jobs with matching job IDs (Job::JobID attribute) as specified with the list of job IDs (jobids parameter) will be remove from the storage.

Note
This method is abstract and an implementation must be provided by specialised classes.
Parameters
jobidslist job IDs for which matching jobs should be remove from storage.
Returns
is returned if any of the matching jobs failed to be removed from the storage, otherwise true is returned.

Implemented in Arc::JobInformationStorageBDB, Arc::JobInformationStorageSQLite, and Arc::JobInformationStorageXML.

◆ Write() [1/2]

virtual bool Arc::JobInformationStorage::Write ( const std::list< Job > &  jobs)
inlinevirtual

Write jobs.

Add jobs to storage. If there already exist a job with a specific job ID in the storage, and a job with the same job ID is tried added to the storage then the existing job will be overwritten.

A specialised implementaion does not necessarily need to be provided. If not provided Write(const std::list<Job>&, std::set<std::string>&, std::list<const Job*>&) will be used.

Parameters
jobsis the list of Job objects which should be added to the storage.
Returns
true is returned if all jobs in the jobs list are written to to storage, otherwise false is returned.
See also
Write(const std::list<Job>&, std::set<std::string>&, std::list<const Job*>&)

Reimplemented in Arc::JobInformationStorageBDB, Arc::JobInformationStorageSQLite, and Arc::JobInformationStorageXML.

◆ Write() [2/2]

virtual bool Arc::JobInformationStorage::Write ( const std::list< Job > &  jobs,
const std::set< std::string > &  prunedServices,
std::list< const Job *> &  newJobs 
)
pure virtual

Write jobs.

Add jobs to storage. If there already exist a job with a specific job ID in the storage, and a job with the same job ID is tried added to the storage then the existing job will be overwritten. For jobs in the storage with a ServiceEndpointURL attribute where the host name is equal to any of the entries in the set referenced by the prunedServices parameter, is removed from the storage, if they are not among the list of jobs referenced by the jobs parameter. A pointer to jobs in the job list (jobs) which does not already exist in the storage will be added to the list of Job object pointers referenced by the newJobs parameter.

Note
This method is abstract and an implementation must be provided by specialised classes.
Parameters
jobsis the list of Job objects which should be added to the storage.
prunedServicesis a set of host names of services whose jobs should be removed if not replaced. This is typically the list of host names for which at least one endpoint was successfully queried. By passing an empty set, all existing jobs are kept, even if jobs are outdated.
newJobsis a reference to a list of pointers to Job objects which are not duplicates.
Returns
true is returned if all jobs in the jobs list are written to to storage, otherwise false is returned.

Implemented in Arc::JobInformationStorageBDB, Arc::JobInformationStorageSQLite, and Arc::JobInformationStorageXML.

Field Documentation

◆ isStorageExisting

bool Arc::JobInformationStorage::isStorageExisting
protected
Since
Added in 4.0.0.

◆ isValid

bool Arc::JobInformationStorage::isValid
protected
Since
Added in 4.0.0.

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