-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob_metadata.h
67 lines (55 loc) · 1.58 KB
/
job_metadata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*-------------------------------------------------------------------------
*
* job_metadata.h
* definition of job metadata functions
*
* Copyright (c) 2010-2015, Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/
#ifndef JOB_METADATA_H
#define JOB_METADATA_H
#include "nodes/pg_list.h"
#if (PG_VERSION_NUM < 120000)
#include "datatype/timestamp.h"
#endif
typedef enum
{
CRON_STATUS_STARTING,
CRON_STATUS_RUNNING,
CRON_STATUS_SENDING,
CRON_STATUS_CONNECTING,
CRON_STATUS_SUCCEEDED,
CRON_STATUS_FAILED
} CronStatus;
/* job metadata data structure */
typedef struct CronJob
{
int64 jobId;
char *scheduleText;
entry schedule;
char *command;
char *nodeName;
int nodePort;
char *database;
char *userName;
bool active;
char *jobName;
} CronJob;
/* global settings */
extern char *CronHost;
extern bool CronJobCacheValid;
extern bool EnableSuperuserJobs;
/* functions for retrieving job metadata */
extern void InitializeJobMetadataCache(void);
extern void ResetJobMetadataCache(void);
extern List * LoadCronJobList(void);
extern CronJob * GetCronJob(int64 jobId);
extern void InsertJobRunDetail(int64 runId, int64 *jobId, char *database, char *username, char *command, char *status);
extern void UpdateJobRunDetail(int64 runId, int32 *job_pid, char *status, char *return_message, TimestampTz *start_time,
TimestampTz *end_time);
extern int64 NextRunId(void);
extern void MarkPendingRunsAsFailed(void);
extern char *GetCronStatus(CronStatus cronstatus);
extern void InvalidateJobCacheCallback(Datum argument, Oid relationId);
#endif