public RpcDatabaseCopyStatus2[] GetCopyStatus(string serverName, RpcGetDatabaseCopyStatusFlags2 collectionFlags2, Guid[] dbGuids, int timeoutMs)
 {
     if (dbGuids == null || dbGuids.Length == 0)
     {
         dbGuids = new Guid[]
         {
             Guid.Empty
         };
     }
     RpcDatabaseCopyStatus2[] statusResults = null;
     ReplayRpcClientWrapper.RunRpcOperation(serverName, null, timeoutMs, TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient)
     {
         RpcErrorExceptionInfo result;
         try
         {
             if (ReplayRpcVersionControl.IsGetCopyStatusEx4RpcSupported(ReplayRpcClientWrapper.GetServerVersion(serverName)))
             {
                 ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatus(): Now making RpccGetCopyStatusEx4() RPC to server {0}.", serverName);
                 RpcErrorExceptionInfo rpcErrorExceptionInfo = rpcClient.RpccGetCopyStatusEx4(collectionFlags2, dbGuids, ref statusResults);
                 if (!rpcErrorExceptionInfo.IsFailed())
                 {
                     ReplayRpcClientWrapper.DeserializeExtendedErrorInfo(statusResults);
                 }
                 result = rpcErrorExceptionInfo;
             }
             else
             {
                 RpcDatabaseCopyStatus[] array = null;
                 ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatus(): Now making GetCopyStatusEx2() RPC to server {0}.", serverName);
                 RpcErrorExceptionInfo copyStatusEx = rpcClient.GetCopyStatusEx2(ReplayRpcClientWrapper.ConvertToLegacyCopyStatusFlags(collectionFlags2), dbGuids, ref array);
                 if (!copyStatusEx.IsFailed() && array != null)
                 {
                     statusResults = ReplayRpcClientWrapper.ConvertLegacyCopyStatusArray(array);
                 }
                 result = copyStatusEx;
             }
         }
         catch (RpcException ex)
         {
             if (ReplayRpcErrorCode.IsRpcTimeoutError(ex.ErrorCode))
             {
                 throw new ReplayServiceDownException(serverName, ex.Message, ex);
             }
             throw;
         }
         return(result);
     });
     return(statusResults);
 }
        public RpcCopyStatusContainer GetCopyStatusWithHealthState(string serverName, RpcGetDatabaseCopyStatusFlags2 collectionFlags2, Guid[] dbGuids, int timeoutMs)
        {
            if (dbGuids == null || dbGuids.Length == 0)
            {
                dbGuids = new Guid[]
                {
                    Guid.Empty
                };
            }
            RpcCopyStatusContainer container = null;

            if (ReplayRpcVersionControl.IsGetCopyStatusWithHealthStateRpcSupported(ReplayRpcClientWrapper.GetServerVersion(serverName)))
            {
                ReplayRpcClientWrapper.RunRpcOperation(serverName, null, timeoutMs, TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient)
                {
                    RpcErrorExceptionInfo result;
                    try
                    {
                        ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatusWithHealthState(): Now making RpccGetCopyStatusWithHealthState() RPC to server {0}.", serverName);
                        RpcErrorExceptionInfo rpcErrorExceptionInfo = rpcClient.RpccGetCopyStatusWithHealthState(collectionFlags2, dbGuids, ref container);
                        if (!rpcErrorExceptionInfo.IsFailed())
                        {
                            ReplayRpcClientWrapper.DeserializeExtendedErrorInfo(container.CopyStatuses);
                        }
                        result = rpcErrorExceptionInfo;
                    }
                    catch (RpcException ex)
                    {
                        if (ReplayRpcErrorCode.IsRpcTimeoutError(ex.ErrorCode))
                        {
                            throw new ReplayServiceDownException(serverName, ex.Message, ex);
                        }
                        throw;
                    }
                    return(result);
                });
            }
            else
            {
                container = new RpcCopyStatusContainer();
                container.HealthStates = null;
                container.CopyStatuses = this.GetCopyStatus(serverName, collectionFlags2, dbGuids, timeoutMs);
            }
            return(container);
        }
        public void RpccEnableReplayLag(string serverName, Guid dbGuid, ActionInitiatorType actionInitiator)
        {
            ServerVersion serverVersion = ReplayRpcClientWrapper.GetServerVersion(serverName);

            if (!ReplayRpcVersionControl.IsDisableReplayLagRpcSupported(serverVersion))
            {
                ExTraceGlobals.ReplayServiceRpcTracer.TraceError <string, ServerVersion, ServerVersion>(0L, "RpccEnableReplayLag(): RPC to server '{0}' not supported. Server version: {1:x}. Supported version: {2:x}.", serverName, serverVersion, ReplayRpcVersionControl.GetCopyStatusEx4RpcSupportVersion);
                throw new ReplayLagRpcUnsupportedException(serverName, serverVersion.ToString(), ReplayRpcVersionControl.GetCopyStatusEx4RpcSupportVersion.ToString());
            }
            ReplayRpcClientWrapper.RunRpcOperation(serverName, new Guid?(dbGuid), TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient)
            {
                if (ReplayRpcVersionControl.IsDisableReplayLagRpcV2Supported(serverVersion))
                {
                    ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string, Guid, ActionInitiatorType>(0L, "RpccEnableReplayLag(): Now making RpccEnableReplayLag2 RPC to server {0} for guid {1} (actionInitiator = {2}).", serverName, dbGuid, actionInitiator);
                    return(rpcClient.RpccEnableReplayLag2(dbGuid, (uint)actionInitiator));
                }
                ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string, Guid, ActionInitiatorType>(0L, "RpccEnableReplayLag(): Now making RpccEnableReplayLag RPC to server {0} for guid {1} (actionInitiator = {2}).", serverName, dbGuid, actionInitiator);
                return(rpcClient.RpccEnableReplayLag(dbGuid));
            });
        }