dba/jobs  library module
PR

Summary

Stop jobs.
Tags

Author: Christian Grün, BaseX Team 2005-21, BSD License

__source : jobs/job-stop.xqm

Related documents
ViewDescriptionFormat
xqdocxqDoc xml file from the source modulexml
xqparsexqparse xml file from the source modulexml

Imports

This module is imported by 0 modules. It imports 1 modules.

(None)
imports
this
imports

Variables

3.1 $dba:CAT

Summary
Top category
Type
xs:string

Functions

4.1 dba:job-discard

Arities: dba:job-discard#1R

Summary
Discards jobs.
Signature
dba:job-discard ( $ids as xs:string* )  as element(rest:response)
Parameters
  • ids as xs:string* job ids
Return
  • 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

    Summary
    Stops jobs.
    Signature
    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)
    Parameters
    • ids as xs:string* job ids
    Return
    • element(rest:response)redirection
    Invokes 4 functions from 4 modules
    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:

    PrefixUri
    annhttp://www.w3.org/2012/xquery
    dbadba/jobs 2 3
    resthttp://exquery.org/ns/restxq
    utildba/util

    6 RestXQ

    Paths defined 2.

    PathMethodFunction
    /dba/job-discardGETdba:job-discard#1
    /dba/job-stopGETdba: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)
    };