Adding a priority mechanism

This commit is contained in:
Eric van der Vlist 2012-04-12 14:06:23 +02:00
parent 6b10b3e51c
commit a0bd1a56fd
4 changed files with 11 additions and 5 deletions

View File

@ -222,6 +222,9 @@ for $as in /archive-set
<parameter name="uuid" type="string">
<xsl:value-of select="/root/action/@uuid"/>
</parameter>
<parameter name="priority" type="string">
<xsl:value-of select="/root/action/@priority"/>
</parameter>
<parameter name="links" type="node-set">
<xsl:copy-of select="/root/links"/>
</parameter>
@ -237,7 +240,7 @@ for $q in /queue return
insert
for $href in distinct-values($links/link/@abs-href)
let $link := $links/link[@abs-href = $href][1]
return <action uuid="{util:uuid()}" type="archive-resource" url="{$link/@abs-href}" directory=$(directory) filename="{$link/@filename}"/>
return <action priority=$(priority) uuid="{util:uuid()}" type="archive-resource" url="{$link/@abs-href}" directory=$(directory) filename="{$link/@filename}"/>
into $q,
for $a in /queue/action where $a/@uuid = $(uuid) return

View File

@ -31,6 +31,9 @@
<parameter name="url" type="string">
<xsl:value-of select="/action/@url"/>
</parameter>
<parameter name="priority" type="string">
<xsl:value-of select="/action/@priority + 1"/>
</parameter>
</config>
</p:input>
<p:output name="data" id="data-access-data"/>
@ -45,7 +48,7 @@ declare namespace util = "http://exist-db.org/xquery/util";
for $q in /queue return
update
insert <action uuid="{util:uuid()}" type="archive-resource" url=$(url) directory=$(directory) filename=$(filename)/>
insert <action priority=$(priority) uuid="{util:uuid()}" type="archive-resource" url=$(url) directory=$(directory) filename=$(filename)/>
into $q,
for $a in /queue/action where $a/@uuid = $(uuid) return

View File

@ -23,7 +23,7 @@ declare namespace util = "http://exist-db.org/xquery/util";
for $q in /queue return
update
insert <action uuid="{util:uuid()}" type="archive-set" url="http://dyomedea.com"/>
insert <action priority="0" uuid="{util:uuid()}" type="archive-set" url="http://dyomedea.com"/>
into $q
]]></xquery>

View File

@ -20,7 +20,7 @@
<p:input name="param">
<xquery><![CDATA[
/queue/action
/queue/action[@priority=max(/queue/action/@priority)]
]]></xquery>
</p:input>