コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: CouchClient.cs プロジェクト: jaimerosales/DreamSeat
 /// <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();
 }
コード例 #3
0
ファイル: CouchClient.cs プロジェクト: jaimerosales/DreamSeat
        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;
        }
コード例 #4
0
 /// <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());
 }