dba/jobs
library modulePR
Summary
Stop jobs.
- Tags
Author: Christian Grün, BaseX Team 2005-21, BSD License
__source : jobs/job-stop.xqm
Imports
This module is imported by 0 modules. It imports 1 modules.
Variables
Functions
4.1 dba:job-discard
Arities: dba:job-discard#1R
dba:job-discard
(
$ids
as
xs:string*
)
as
element(rest:response)
- ids
as
xs:string*
job ids
element(rest:response)
redirection
Invokes 1 functions from 1 modules
Invoked by 0 functions from 0 modules
Annotations
%rest:GET | () |
%rest:path | ('/dba/job-discard') |
%rest:query-param | ('id','{$ids}') |
Source ( 5 lines)
function dba:job-discard(
$ids as xs:string*
) as element(rest:response) {
dba:job-stop($ids, 'discarded')
}
4.2 dba:job-stop
Arities: dba:job-stop#1Rdba:job-stop#2P
dba:job-stop
(
$ids
as
xs:string*
)
as
element(rest:response)
dba:job-stop
(
$ids
as
xs:string*
, $action
as
xs:string
)
as
element(rest:response)
- ids
as
xs:string*
job ids
element(rest:response)
redirection
Invokes 4 functions from 4 modules
- dba:job-stop#2
- util:info#3
- {http://basex.org/modules/jobs}stop#0
- {http://basex.org/modules/web}redirect#2
Invoked by 2 functions from 1 modules
Annotations
%rest:GET | () |
%rest:path | ('/dba/job-stop') |
%rest:query-param | ('id','{$ids}') |
Annotations
%private | () |
Source ( 17 lines)
function dba:job-stop(
$ids as xs:string*
) as element(rest:response) {
dba:job-stop($ids, 'stopped')
}
function dba:job-stop(
$ids as xs:string*,
$action as xs:string
) as element(rest:response) {
let $params := try {
$ids ! jobs:stop(.),
map { 'info': util:info($ids, 'job', $action) }
} catch * {
map { 'error': $err:description }
}
return web:redirect($dba:CAT, $params)
}
Namespaces
The following namespaces are defined:
Prefix | Uri |
---|---|
ann | http://www.w3.org/2012/xquery |
dba | dba/jobs 2 3 |
rest | http://exquery.org/ns/restxq |
util | dba/util |
6 RestXQ
Paths defined 2.
Path | Method | Function |
---|---|---|
/dba/job-discard | GET | dba:job-discard#1 |
/dba/job-stop | GET | dba:job-stop#1 |
Source Code
(:~
: Stop jobs.
:
: @author Christian Grün, BaseX Team 2005-21, BSD License
:)
module namespace dba = 'dba/jobs';
import module namespace util = 'dba/util' at '../lib/util.xqm';
(:~ Top category :)
declare variable $dba:CAT := 'jobs';
(:~
: Stops jobs.
: @param $ids job ids
: @return redirection
:)
declare
%rest:GET
%rest:path('/dba/job-stop')
%rest:query-param('id', '{$ids}')
function dba:job-stop(
$ids as xs:string*
) as element(rest:response) {
dba:job-stop($ids, 'stopped')
};
(:~
: Discards jobs.
: @param $ids job ids
: @return redirection
:)
declare
%rest:GET
%rest:path('/dba/job-discard')
%rest:query-param('id', '{$ids}')
function dba:job-discard(
$ids as xs:string*
) as element(rest:response) {
dba:job-stop($ids, 'discarded')
};
(:~
: Stops jobs.
: @param $ids job ids
: @param $action action
: @return redirection
:)
declare %private function dba:job-stop(
$ids as xs:string*,
$action as xs:string
) as element(rest:response) {
let $params := try {
$ids ! jobs:stop(.),
map { 'info': util:info($ids, 'job', $action) }
} catch * {
map { 'error': $err:description }
}
return web:redirect($dba:CAT, $params)
};