Beispiel #1
0
 public RedisManagedServer(RedisManagerSettings settings, RedisRole role,
                           Action <object, RedisCardioPulseStatus> onPulseStateChange)
     : base(settings)
 {
     Role = role;
     m_OnPulseStateChange = onPulseStateChange;
 }
Beispiel #2
0
 public RedisManagedServerGroup(RedisManagerSettings settings, RedisRole role,
                                RedisManagedServerNode[] nodes, Action <object, RedisCardioPulseStatus> onPulseStateChange)
     : base(settings, role, nodes, onPulseStateChange)
 {
     if (!(role == RedisRole.Slave || role == RedisRole.Master))
     {
         throw new RedisException("Role must be master or slave");
     }
 }
Beispiel #3
0
        public RedisManagedMSGroup(RedisManagerSettings settings,
                                   RedisManagedServerGroup masters, RedisManagedServerGroup slaves = null,
                                   Action <object, RedisCardioPulseStatus> onPulseStateChange      = null)
        {
            m_OnPulseStateChange         = onPulseStateChange;
            m_Settings                   = settings;
            m_UseSlaveAsMasterWhenNeeded = settings.UseSlaveAsMasterIfNoMasterFound;

            ExchangeSlavesInternal(slaves ?? new RedisManagedServerGroup(settings, RedisRole.Slave, null, null));
            ExchangeMastersInternal(masters ?? new RedisManagedServerGroup(settings, RedisRole.Master, null, null));
        }
Beispiel #4
0
 public RedisManagedServerNode(RedisManagerSettings settings, RedisRole role, RedisManagedServer server,
                               Action <object, RedisCardioPulseStatus> onPulseStateChange, bool ownsSeed = true)
     : base(settings, role, server, onPulseStateChange, ownsSeed)
 {
     m_OnPulseStateChange = onPulseStateChange;
     m_EndPoint           = (server != null) ? server.EndPoint : RedisEndPoint.Empty;
     if (server != null)
     {
         server.SetOnPulseStateChange(onPulseStateChange);
     }
 }
Beispiel #5
0
        public RedisManagedSentinelGroup(RedisManagerSettings settings, string masterName, RedisManagedSentinelNode[] nodes,
                                         Action <object, RedisCardioPulseStatus> onPulseStateChange)
            : base(settings, RedisRole.Sentinel, nodes, onPulseStateChange)
        {
            masterName = (masterName ?? String.Empty).Trim();
            if (masterName.IsEmpty())
            {
                throw new RedisFatalException(new ArgumentNullException("masterName"), RedisErrorCode.MissingParameter);
            }

            m_MasterName = masterName;
        }
Beispiel #6
0
        protected RedisManagedNode(RedisManagerSettings settings, RedisRole role, object seed,
                                   Action <object, RedisCardioPulseStatus> onPulseStateChange, bool ownsSeed = true)
        {
            m_Role     = role;
            m_OwnsSeed = ownsSeed;
            m_EndPoint = RedisEndPoint.Empty;

            m_Settings           = settings;
            m_OnPulseStateChange = onPulseStateChange;

            ExchangeSeedInternal(seed);
            AttachToCardio();
        }
Beispiel #7
0
        public RedisManagedSentinelNode(RedisManagerSettings settings, RedisManagedSentinelListener sentinel,
                                        Action <object, RedisCardioPulseStatus> onPulseStateChange, bool ownsSeed = true)
            : base(settings, RedisRole.Sentinel, sentinel, onPulseStateChange, ownsSeed)
        {
            m_OnPulseStateChange = onPulseStateChange;

            m_EndPoint = GetEndPoint(sentinel);

            if (sentinel != null)
            {
                sentinel.SetOnPulseStateChange(onPulseStateChange);
            }
        }
Beispiel #8
0
        protected RedisManagedNodesGroup(RedisManagerSettings settings, RedisRole role,
                                         RedisManagedNode[] nodes, Action <object, RedisCardioPulseStatus> onPulseStateChange)
        {
            Role = role;
            m_OnPulseStateChange = onPulseStateChange;
            m_Nodes    = nodes ?? new RedisManagedNode[0];
            m_Settings = settings;

            if (nodes.IsEmpty())
            {
                m_NodeIndex = -1;
            }
            else
            {
                foreach (var node in nodes)
                {
                    if (node != null)
                    {
                        node.SetOnPulseStateChange(OnPulseStateChange);
                    }
                }
            }
        }
Beispiel #9
0
 public RedisManagedEndPointResolver(string name, RedisManagerSettings settings)
     : base(name, settings)
 {
 }