mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 18:43:18 +08:00
This moves the SQL definitions for policy and job APIs to their separate files to improve code structure. Previously, all of these user-visible API functions were located in the `bgw_scheduler.sql` file, mixing internal and public functions and APIs. To improved the structure, all API-related functions are now located in their own distinct SQL files that have the `_api.sql` file ending. Internal policy functions have been moved to `policy_internal.sql`.
31 lines
1.2 KiB
SQL
31 lines
1.2 KiB
SQL
-- This file and its contents are licensed under the Apache License 2.0.
|
|
-- Please see the included NOTICE for copyright information and
|
|
-- LICENSE-APACHE for a copy of the license.
|
|
|
|
CREATE OR REPLACE FUNCTION add_job(
|
|
proc REGPROC,
|
|
schedule_interval INTERVAL,
|
|
config JSONB DEFAULT NULL,
|
|
initial_start TIMESTAMPTZ DEFAULT NULL,
|
|
scheduled BOOL DEFAULT true
|
|
) RETURNS INTEGER AS '@MODULE_PATHNAME@', 'ts_job_add' LANGUAGE C VOLATILE;
|
|
|
|
CREATE OR REPLACE FUNCTION delete_job(job_id INTEGER) RETURNS VOID AS '@MODULE_PATHNAME@', 'ts_job_delete' LANGUAGE C VOLATILE STRICT;
|
|
CREATE OR REPLACE PROCEDURE run_job(job_id INTEGER) AS '@MODULE_PATHNAME@', 'ts_job_run' LANGUAGE C;
|
|
|
|
-- Returns the updated job schedule values
|
|
CREATE OR REPLACE FUNCTION alter_job(
|
|
job_id INTEGER,
|
|
schedule_interval INTERVAL = NULL,
|
|
max_runtime INTERVAL = NULL,
|
|
max_retries INTEGER = NULL,
|
|
retry_period INTERVAL = NULL,
|
|
scheduled BOOL = NULL,
|
|
config JSONB = NULL,
|
|
next_start TIMESTAMPTZ = NULL,
|
|
if_exists BOOL = FALSE
|
|
)
|
|
RETURNS TABLE (job_id INTEGER, schedule_interval INTERVAL, max_runtime INTERVAL, max_retries INTEGER, retry_period INTERVAL, scheduled BOOL, config JSONB, next_start TIMESTAMPTZ)
|
|
AS '@MODULE_PATHNAME@', 'ts_job_alter'
|
|
LANGUAGE C VOLATILE;
|