Ejemplo n.º 1
0
 /**
  * Starts the replication process. $printStatus can be used to print the
  * status of the continuous replication to the STDOUT. The $getFinalReport
  * can be used to enable/disable returning of an array containing the
  * replication report in case of continuous replication. This is useful
  * when there are large number of documents. So when the replication is
  * continuous,to see the status set $printStatus to true and $getFinalReport
  * to false.
  *
  * @param string $logFile
  * @return array
  * @throws HTTPException
  * @throws \Exception
  */
 public function start($printStatus = true, $getFinalReport = false)
 {
     // DB info (via GET /{db}) for source and target.
     list($sourceInfo, $targetInfo) = $this->verifyPeers($this->source, $this->target, $this->task);
     $this->task->setRepId($this->generateReplicationId());
     // Replication log (via GET /{db}/_local/{docid}) for source and target.
     list($sourceLog, $targetLog) = $this->getReplicationLog();
     $this->task->setSinceSeq($this->compareReplicationLogs($sourceLog, $targetLog));
     // Main replication processing
     $response = $this->locateChangedDocumentsAndReplicate($printStatus, $getFinalReport);
     $this->ensureFullCommit();
     // Return the details of the replication.
     return $response;
 }