public Result <JObject> TriggerReplication(ReplicationOptions aReplicationOptions, Result <JObject> aResult) { if (aReplicationOptions == null) { throw new ArgumentNullException("aReplicationOptions"); } if (aResult == null) { throw new ArgumentNullException("aResult"); } Plug p = BasePlug.At(Constants.REPLICATE); string json = aReplicationOptions.ToString(); p.Post(DreamMessage.Ok(MimeType.JSON, json), new Result <DreamMessage>()).WhenDone( a => { if ((a.Status == DreamStatus.Accepted) || (a.Status == DreamStatus.Ok)) { aResult.Return(JObject.Parse(a.ToText())); } else { aResult.Throw(new CouchException(a)); } }, aResult.Throw ); return(aResult); }
/// <summary> /// Triggers one way replication from the source to target. If bidirection is needed call this method twice with the source and target args reversed. /// </summary> /// <param name="aReplicationOptions">Replication options</param> /// <returns></returns> public JObject TriggerReplication(ReplicationOptions aReplicationOptions) { return TriggerReplication(aReplicationOptions, new Result<JObject>()).Wait(); }
public Result<JObject> TriggerReplication(ReplicationOptions aReplicationOptions, Result<JObject> aResult) { if (aReplicationOptions == null) throw new ArgumentNullException("aReplicationOptions"); if (aResult == null) throw new ArgumentNullException("aResult"); Plug p = BasePlug.At(Constants.REPLICATE); string json = aReplicationOptions.ToString(); p.Post(DreamMessage.Ok(MimeType.JSON, json), new Result<DreamMessage>()).WhenDone( a => { if((a.Status == DreamStatus.Accepted)|| (a.Status == DreamStatus.Ok)) { aResult.Return(JObject.Parse(a.ToText())); } else { aResult.Throw(new CouchException(a)); } }, aResult.Throw ); return aResult; }
/// <summary> /// Triggers one way replication from the source to target. If bidirection is needed call this method twice with the source and target args reversed. /// </summary> /// <param name="aReplicationOptions">Replication options</param> /// <returns></returns> public JObject TriggerReplication(ReplicationOptions aReplicationOptions) { return(TriggerReplication(aReplicationOptions, new Result <JObject>()).Wait()); }