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"> <parameter name="uuid" type="string">
<xsl:value-of select="/root/action/@uuid"/> <xsl:value-of select="/root/action/@uuid"/>
</parameter> </parameter>
<parameter name="priority" type="string">
<xsl:value-of select="/root/action/@priority"/>
</parameter>
<parameter name="links" type="node-set"> <parameter name="links" type="node-set">
<xsl:copy-of select="/root/links"/> <xsl:copy-of select="/root/links"/>
</parameter> </parameter>
@ -237,7 +240,7 @@ for $q in /queue return
insert insert
for $href in distinct-values($links/link/@abs-href) for $href in distinct-values($links/link/@abs-href)
let $link := $links/link[@abs-href = $href][1] 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, into $q,
for $a in /queue/action where $a/@uuid = $(uuid) return for $a in /queue/action where $a/@uuid = $(uuid) return

View File

@ -31,6 +31,9 @@
<parameter name="url" type="string"> <parameter name="url" type="string">
<xsl:value-of select="/action/@url"/> <xsl:value-of select="/action/@url"/>
</parameter> </parameter>
<parameter name="priority" type="string">
<xsl:value-of select="/action/@priority + 1"/>
</parameter>
</config> </config>
</p:input> </p:input>
<p:output name="data" id="data-access-data"/> <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 for $q in /queue return
update 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, into $q,
for $a in /queue/action where $a/@uuid = $(uuid) return 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 for $q in /queue return
update 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 into $q
]]></xquery> ]]></xquery>

View File

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