15#define UPDATE_JOBS_TIMEOUT 300000000
16#define MAX_JOB_RETRIES 1
17#define RECOUNT_WAIT_TIME 600
19using namespace jobTypes;
30 virtual void connect(std::string ip,
int port);
95 void deleteTopJob(CassUuid
id, cass_int64_t priority);
100 void deleteCurrentJob(CassUuid
id);
110 Job retrieveCurrentJob(
const CassRow *row);
115 void setPreparedStatements();
120 virtual void updateCurrentJob(CassUuid jobid,
Job job,
long long currentTime);
125 CassSession *connection;
128 long long timeLastRecount = -1;
130 const CassPrepared *preparedGetTopJob;
131 const CassPrepared *preparedDeleteTopJob;
132 const CassPrepared *preparedAddCurrentJob;
133 const CassPrepared *preparedGetCurrentJob;
134 const CassPrepared *preparedGetCurrentJobs;
135 const CassPrepared *preparedDeleteCurrentJob;
136 const CassPrepared *preparedAddFailedJob;
137 const CassPrepared *preparedAmountOfJobs;
138 const CassPrepared *preparedUploadJob;
139 const CassPrepared *preparedUploadRetryJob;
140 const CassPrepared *preparedCrawlID;
141 const CassPrepared *preparedUpdateCrawlID;
Handles interaction with database when dealing with job requests.
Definition: DatabaseConnection.h:25
virtual int getCrawlID()
Returns the current crawl ID in the database.
Definition: DatabaseConnection.cpp:361
virtual void updateCurrentJobs()
Regularly updates the current jobs to check for a timeout.
Definition: DatabaseConnection.cpp:455
virtual void setCrawlID(int id)
Sets the crawl ID in the database to the given value.
Definition: DatabaseConnection.cpp:390
virtual Job getTopJob()
Retrieves the url of the first job in the jobs table and returns it.
Definition: DatabaseConnection.cpp:65
virtual Job getCurrentJob(std::string jobid)
Retrieves a job with matching jobid in the currentjobs table.
Definition: DatabaseConnection.cpp:229
virtual long long getCurrentJobTime(std::string jobid)
Retrieves the time of a job with matching jobid in the currentjobs table.
Definition: DatabaseConnection.cpp:150
virtual void connect(std::string ip, int port)
Connect to the database.
Definition: DatabaseConnection.cpp:16
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 prev...
Definition: DatabaseConnection.cpp:411
virtual long long addCurrentJob(Job job)
Adds a job to the currentjobs table.
Definition: DatabaseConnection.cpp:189
virtual void addFailedJob(FailedJob job)
Adds a job to the failedjobs table.
Definition: DatabaseConnection.cpp:294
virtual int getNumberOfJobs()
Returns the amount of jobs in the jobs table.
Definition: DatabaseConnection.cpp:327
Mirrors an entry of the failedjobs table in the database. Difference with Job is the addition of a re...
Definition: JobTypes.h:41
Mirrors an entry of the currentjobs table in the database.
Definition: JobTypes.h:16