public RedisManagedPoolGroup(RedisManagerSettings settings, RedisRole role,
                              RedisManagedPoolNode[] 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");
     }
 }
        public RedisManagedMSGroup(RedisManagerSettings settings,
                                   RedisManagedPoolGroup masters, RedisManagedPoolGroup slaves = null,
                                   Action <object, RedisCardioPulseStatus> onPulseStateChange  = null)
        {
            m_OnPulseStateChange         = onPulseStateChange;
            m_Settings                   = settings;
            m_UseSlaveAsMasterWhenNeeded = settings.UseSlaveAsMasterIfNoMasterFound;

            ExchangeSlavesInternal(slaves ?? new RedisManagedPoolGroup(settings, RedisRole.Slave, null, null));
            ExchangeMastersInternal(masters ?? new RedisManagedPoolGroup(settings, RedisRole.Master, null, null));
        }
Exemple #3
0
        protected RedisManagedNode(RedisManagerSettings settings, RedisRole role, object seed,
                                   Action <object, RedisCardioPulseStatus> onPulseStateChange, bool ownsSeed = true)
        {
            m_Seed     = seed;
            m_Role     = role;
            m_OwnsSeed = ownsSeed;
            m_EndPoint = RedisEndPoint.Empty;

            m_Settings           = settings;
            m_OnPulseStateChange = onPulseStateChange;
        }
Exemple #4
0
        public RedisManagedPoolNode(RedisManagerSettings settings, RedisRole role, RedisManagedPool pool,
                                    Action <object, RedisCardioPulseStatus> onPulseStateChange, bool ownsSeed = true)
            : base(settings, role, pool, onPulseStateChange, ownsSeed)
        {
            m_EndPoint = (pool != null) ? pool.EndPoint : RedisEndPoint.Empty;

            if (pool != null)
            {
                pool.PoolPulseStateChanged   += OnPoolPulseStateChange;
                pool.PubSubPulseStateChanged += OnPubSubPulseStateChange;
            }
        }
        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;
        }
Exemple #6
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);
                    }
                }
            }
        }
 public RedisManagedEndPointResolver(string name, RedisManagerSettings settings)
     : base(name, settings)
 {
 }
Exemple #8
0
 public RedisManagedSentinelNode(RedisManagerSettings settings, RedisManagedSentinelListener listener,
                                 Action <object, RedisCardioPulseStatus> onPulseStateChange, bool ownsSeed = true)
     : base(settings, RedisRole.Sentinel, listener, onPulseStateChange, ownsSeed)
 {
     m_EndPoint = (listener != null) ? listener.EndPoint : RedisEndPoint.Empty;
 }