|
|
flexrep:document-reset(
|
|
$uri as xs:string,
|
|
$domain-id as xs:unsignedLong,
|
|
[$target-ids as xs:unsignedLong*]
|
| ) as empty-sequence() |
|
 |
Summary:
This function resets the URI status for all replication targets.
A reset involves retaining any record of last success, clearing any failure status, and
setting the time for the next replication attempt to the current time. The status is reset
for the specified $target-ids. If no $target-ids parameter is
specified, then the URI status for all replication targets is reset.
Resetting the URI status for a target is useful if the document has errored out due to too
many failures, or if you want to replicate the document again.
|
Parameters:
$uri
:
The URI to be assigned the new status.
|
$domain-id
:
The ID of the replicated domain.
|
$target-ids
(optional):
The ID of the replication target.
|
|
Example:
xquery version "1.0-ml";
import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication"
at "/MarkLogic/flexrep.xqy";
(: Obtain the domain ID from the database used by the Master to enable CPF. :)
let $domain := xdmp:eval(
'xquery version "1.0-ml";
import module namespace dom = "http://marklogic.com/cpf/domains"
at "/MarkLogic/cpf/domains.xqy";
fn:data(dom:get( "Replicated Content" )//dom:domain-id)',
(),
<options xmlns="xdmp:eval">
<database>{xdmp:database("MyTriggers")}</database>
</options>)
let $cfg := flexrep:configuration-get($domain, fn:true())
let $target-id := flexrep:configuration-target-get-id($cfg, "Replica")
return
flexrep:document-reset("http://localhost:8011/", $domain, $target-id)
(: Resets the URI status for the "Replica" target. :)
|
|
|
|
flexrep:domain-status(
|
|
$domain-id as xs:unsignedLong,
|
|
[$with-targets as xs:boolean],
|
|
[$terse as xs:boolean]
|
| ) as element(flexrep:domain-status) |
|
 |
Summary:
This function returns the replication status for the specified
replicated CPF domain.
|
Parameters:
$domain-id
:
The ID of the replicated domain.
|
$with-targets
(optional):
Set to true to include status information for each target.
Otherwise set to false.
|
$terse
(optional):
Set to true to prevent counts from being returned for
each of the individual states (deleted, error, updated, and so on).
Otherwise set to false.
|
|
Example:
xquery version "1.0-ml";
import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication"
at "/MarkLogic/flexrep.xqy";
(: Obtain the domain ID from the database used by the Master to enable CPF. :)
let $domain := xdmp:eval(
'xquery version "1.0-ml";
import module namespace dom = "http://marklogic.com/cpf/domains"
at "/MarkLogic/cpf/domains.xqy";
fn:data(dom:get( "Replicated Content" )//dom:domain-id)',
(),
<options xmlns="xdmp:eval">
<database>{xdmp:database("MyTriggers")}</database>
</options>)
let $cfg := flexrep:configuration-get($domain, fn:true())
let $target-id := flexrep:configuration-target-get-id($cfg, "Replica")
return flexrep:domain-status($domain, fn:true(), fn:false())
(: Returns the status of the domain and its targets. :)
|
|
|
|
flexrep:domain-target-reset(
|
|
$domain-id as xs:unsignedLong,
|
|
$target-ids as xs:unsignedLong*
|
| ) as empty-sequence() |
|
 |
Summary:
This function resets the URI status for the specified replication targets.
A reset involves retaining any record of last success, clearing any failure status, and
setting the time for the next replication attempt to the current time. The status is reset
for the specified $target-ids.
Resetting the URI status for a target is useful if the document has errored out due to too
many failures, or if you want to replicate the document again.
|
Parameters:
$domain-id
:
The ID of the replicated domain.
|
$target-ids
:
The ID of the replication target.
|
|
Example:
xquery version "1.0-ml";
import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication"
at "/MarkLogic/flexrep.xqy";
(: Obtain the domain ID from the database used by the Master to enable CPF. :)
let $domain := xdmp:eval(
'xquery version "1.0-ml";
import module namespace dom = "http://marklogic.com/cpf/domains"
at "/MarkLogic/cpf/domains.xqy";
fn:data(dom:get( "Replicated Content" )//dom:domain-id)',
(),
<options xmlns="xdmp:eval">
<database>{xdmp:database("MyTriggers")}</database>
</options>)
let $cfg := flexrep:configuration-get($domain, fn:true())
let $target-id := flexrep:configuration-target-get-id($cfg, "Replica")
return flexrep:domain-target-reset($domain, ($target-id))
(: Resets the URI status for the "Replica" target. :)
|
|
|
|
flexrep:target-create(
|
|
$cfg as element(flexrep:configuration),
|
|
$name as xs:string,
|
|
$urls as xs:string*,
|
|
$retry-seconds-min as xs:unsignedInt?,
|
|
$retry-seconds-max as xs:unsignedInt?,
|
|
$documents-per-batch as xs:unsignedInt?,
|
|
$enabled as xs:boolean?,
|
|
$http-options as element(flexrep:http-options)?,
|
|
$replicate-cpf as xs:boolean?,
|
|
$filter-module as xs:string?,
|
|
$filter-options as element(flexrep:filter-options)?
|
| ) as element(flexrep:configuration) |
|
 |
Summary:
This function creates a new target and add it to the specified
configuration. A random ID is chosen for the target. You must subsequently use
flexrep:configuration-insert to write the modified configuration
into the database.
|
Parameters:
$cfg
:
The configuration to which to add the target.
|
$name
:
The name of the target.
|
$urls
:
The URLs to be used to push replicated content to, with the load spread
across them if there is more than one. If none are specified, the target is expected to
do a pull.
|
$retry-seconds-min
:
The minimum time to wait before scheduling a push retry.
|
$retry-seconds-max
:
The maximum time to wait before scheduling a push retry.
|
$documents-per-batch
:
The number of documents to attempt to replicate from a
single invocation of the scheduled replication task.
|
$enabled
:
Specifies whether or not this target is enabled.
|
$http-options
:
The HTTP options in XML format.
|
$replicate-cpf
:
Determines whether to replicate CPF. Set to fn:true to replicate CPF. Otherwise
set to fn:false. In most circumstances, you will not want to replicate CPF.
|
$filter-module
:
A main module to filter replication attempts.
|
$filter-options
:
The options to pass to the filter module.
|
|
Example:
xquery version "1.0-ml";
import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication"
at "/MarkLogic/flexrep.xqy";
(: Obtain the ID of the replicated CPF domain from the Triggers database. :)
let $domain:= xdmp:eval(
'xquery version "1.0-ml";
import module namespace dom = "http://marklogic.com/cpf/domains"
at "/MarkLogic/cpf/domains.xqy";
fn:data(dom:get( "Replicated Content" )//dom:domain-id)',
(),
<options xmlns="xdmp:eval">
<database>{xdmp:database("MyTriggers")}</database>
</options>)
(: Obtain the replication configuration. :)
let $cfg := flexrep:configuration-get($domain, fn:true())
(: Specify the HTTP options for the replication target. :)
let $http-options :=
<flexrep:http-options
xmlns:flexrep="http://marklogic.com/xdmp/flexible-replication">
<http:authentication xmlns:http="xdmp:http">
<http:username>admin</http:username>
<http:password>admin</http:password>
</http:authentication>
<http:client-cert xmlns:http="xdmp:http"/>
<http:client-key xmlns:http="xdmp:http"/>
<http:pass-phrase xmlns:http="xdmp:http"/>
</flexrep:http-options>
(: Create the replication target. :)
let $cfg := flexrep:target-create(
$cfg,
"Replica",
"http://localhost:8011/",
60,
300,
10,
fn:true(),
$http-options,
fn:false(),
(),
() )
(: Insert the changes to the replication configuration. :)
return flexrep:configuration-insert($cfg)
(: Creates a replication target, named "Replica." :)
|
|
|