SearchSECODatabaseAPI
DatabaseConnection Class Reference

Handles interaction with database when dealing with job requests. More...

#include <DatabaseConnection.h>

Public Member Functions

virtual void connect (std::string ip, int port)
 Connect to the database.
 
virtual void uploadJob (Job job, bool newJob)
 Adds a job to the database given the url to a repository and a priority, together with number of previous tries and a timeout.
 
virtual Job getTopJob ()
 Retrieves the url of the first job in the jobs table and returns it. More...
 
virtual Job getCurrentJob (std::string jobid)
 Retrieves a job with matching jobid in the currentjobs table. More...
 
virtual long long getCurrentJobTime (std::string jobid)
 Retrieves the time of a job with matching jobid in the currentjobs table. More...
 
virtual long long addCurrentJob (Job job)
 Adds a job to the currentjobs table.
 
virtual void addFailedJob (FailedJob job)
 Adds a job to the failedjobs table.
 
virtual int getNumberOfJobs ()
 Returns the amount of jobs in the jobs table.
 
virtual int getCrawlID ()
 Returns the current crawl ID in the database.
 
virtual void setCrawlID (int id)
 Sets the crawl ID in the database to the given value.
 
virtual void updateCurrentJobs ()
 Regularly updates the current jobs to check for a timeout.
 

Detailed Description

Handles interaction with database when dealing with job requests.

Member Function Documentation

◆ getCurrentJob()

Job DatabaseConnection::getCurrentJob ( std::string  jobid)
virtual

Retrieves a job with matching jobid in the currentjobs table.

Returns
Job object containing information on job, or nullptr if no match was present.

◆ getCurrentJobTime()

long long DatabaseConnection::getCurrentJobTime ( std::string  jobid)
virtual

Retrieves the time of a job with matching jobid in the currentjobs table.

Returns
The time of the job. Returns -1 if job is unknown or an error occured.

◆ getTopJob()

Job DatabaseConnection::getTopJob ( )
virtual

Retrieves the url of the first job in the jobs table and returns it.

Returns
Job object containing data on the top job.

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