Exemplo n.º 1
0
        public RedisResult <RedisIsMasterDownInfo> IsMasterDownByAddr(string ipAddress, int port, string runId)
        {
            if (ipAddress.IsEmpty())
            {
                throw new ArgumentNullException("ipAddress");
            }

            if (runId.IsEmpty())
            {
                throw new ArgumentNullException("runId");
            }

            var raw = ExpectArray(RedisCommandList.Sentinel, RedisCommandList.SentinelIsMasterDownByAddr,
                                  ipAddress.ToBytes(), port.ToBytes(),
                                  ((long)RedisCommon.EpochNow()).ToBytes(), runId.ToBytes());

            if (!ReferenceEquals(raw, null))
            {
                var rawValue = raw.Value;
                if (!ReferenceEquals(rawValue, null) && rawValue.Type == RedisRawObjectType.Array)
                {
                    var info = RedisIsMasterDownInfo.Parse(rawValue);
                    return(new RedisResult <RedisIsMasterDownInfo>(info));
                }
            }
            return(new RedisResult <RedisIsMasterDownInfo>(RedisIsMasterDownInfo.Empty));
        }
        public RedisResult <RedisIsMasterDownInfo> IsMasterDownByAddr(string ipAddress, int port, string runId)
        {
            if (ipAddress.IsEmpty())
            {
                throw new ArgumentNullException("ipAddress");
            }

            if (runId.IsEmpty())
            {
                throw new ArgumentNullException("runId");
            }

            var array = ExpectArray(new RedisCommand(RedisConstants.UninitializedDbIndex, RedisCommandList.Sentinel, RedisCommandList.SentinelIsMasterDownByAddr,
                                                     ipAddress.ToBytes(), port.ToBytes(),
                                                     ((long)RedisCommon.EpochNow()).ToBytes(), runId.ToBytes()));

            if (!ReferenceEquals(array, null))
            {
                var info = RedisIsMasterDownInfo.Parse(array);
                return(new RedisResult <RedisIsMasterDownInfo>(info));
            }
            return(new RedisResult <RedisIsMasterDownInfo>(RedisIsMasterDownInfo.Empty));
        }