Example #1
0
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     if (message.State == VNodeState.Master || message.State == VNodeState.Slave)
     {
         _logManager.Initialise();
     }
 }
Example #2
0
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     if (message.State == VNodeState.Leader || message.State == VNodeState.Follower)
     {
         _logManager.Initialise();
     }
 }
		public void Handle(SystemMessage.StateChangeMessage message) {
			_state = message.State;

			if (message.State == VNodeState.Leader)
				_noQuorumTimestamp = TimeSpan.Zero;

			if (message.State == VNodeState.ShuttingDown)
				_stop = true;
		}
Example #4
0
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            _state = message.State;

            if (message.State == VNodeState.ShuttingDown)
            {
                _stop = true;
            }
        }
Example #5
0
 private void Handle(SystemMessage.StateChangeMessage msg)
 {
     switch (msg.State)
     {
     case Data.VNodeState.Master:
         _epochIds.Add(((SystemMessage.BecomeMaster)msg).EpochId);
         break;
     }
 }
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            _currentState = message.State;
            if (_currentState != VNodeState.Master)
            {
                _ready = false;
            }

            StartWhenConditionsAreMet();
        }
Example #7
0
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            CurrentRole = message.State;
            var replicaState = message as SystemMessage.ReplicaStateMessage;

            CurrentLeader = replicaState == null ? null : replicaState.Leader;
            _cluster      = UpdateCluster(_cluster, x => x.InstanceId == NodeInfo.InstanceId ? GetUpdatedMe(x) : x,
                                          _timeProvider, DeadMemberRemovalPeriod);

            _bus.Publish(new GossipMessage.GossipUpdated(_cluster));
        }
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            _state = message.State;

            if (message.State == VNodeState.Master)
            {
                return;
            }
            Log.Debug("Persistent subscriptions received state change to {0}. Stopping listening", _state);
            ShutdownSubscriptions();
            Stop();
        }
Example #9
0
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            CurrentRole = message.State;
            var replicaState = message as SystemMessage.ReplicaStateMessage;

            CurrentMaster = replicaState == null ? null : replicaState.Master;
            _cluster      = UpdateCluster(_cluster, x => x.InstanceId == NodeInfo.InstanceId ? GetUpdatedMe(x) : x);

            //if (_cluster.HasChangedSince(oldCluster))
            //LogClusterChange(oldCluster, _cluster, _nodeInfo.InternalHttp);
            _bus.Publish(new GossipMessage.GossipUpdated(_cluster));
        }
Example #10
0
        private void Handle(SystemMessage.StateChangeMessage msg)
        {
            switch (msg.State)
            {
            case Data.VNodeState.Master:
                _expectedNumberOfRoleAssignments.Signal();
                break;

            case Data.VNodeState.Slave:
                _expectedNumberOfRoleAssignments.Signal();
                break;
            }
        }
Example #11
0
        private void Handle(SystemMessage.StateChangeMessage msg)
        {
            switch (msg.State)
            {
            case Data.VNodeState.Master:
                _expectedNumberOfRoleAssignments?.Signal();
                _epochIds.Add(((SystemMessage.BecomeMaster)msg).EpochId);
                break;

            case Data.VNodeState.Slave:
                _expectedNumberOfRoleAssignments?.Signal();
                _epochIds.Add(((SystemMessage.BecomeSlave)msg).EpochId);
                break;
            }
        }
Example #12
0
        private Guid GetEpochIdFromStateChange(SystemMessage.StateChangeMessage message)
        {
            Guid epochId = Guid.Empty;

            switch (message.State)
            {
            case VNodeState.Master:
                epochId = ((SystemMessage.BecomeMaster)message).EpochId;
                break;

            case VNodeState.Slave:
                epochId = ((SystemMessage.BecomeSlave)message).EpochId;
                break;
            }
            return(epochId);
        }
        public override void Handle(SystemMessage.StateChangeMessage message)
        {
            if (message.State == VNodeState.PreMaster)
            {
                if (_activeChunk != null)
                {
                    _activeChunk.MarkForDeletion();
                    _activeChunk = null;
                }
                _subscriptionId       = Guid.Empty;
                _subscriptionPos      = -1;
                _ackedSubscriptionPos = -1;
            }

            base.Handle(message);
        }
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            _nodeState = message.State;
            if (_subsystemState == SubsystemState.NotReady)
            {
                return;
            }

            if (_nodeState == VNodeState.Leader)
            {
                StartComponents();
            }
            else
            {
                StopComponents();
            }
        }
        public virtual void Handle(SystemMessage.StateChangeMessage message)
        {
            _vnodeState = message.State;

            switch (message.State)
            {
            case VNodeState.Master: {
                _indexWriter.Reset();
                EpochManager.WriteNewEpoch();                                 // forces flush
                break;
            }

            case VNodeState.ShuttingDown: {
                Writer.Close();
                break;
            }
            }
        }
        public virtual void Handle(SystemMessage.StateChangeMessage message)
        {
            _vnodeState = message.State;

            switch (message.State)
            {
            case VNodeState.Leader: {
                _indexWriter.Reset();
                EpochManager.WriteNewEpoch(((SystemMessage.BecomeLeader)message).EpochNumber);
                break;
            }

            case VNodeState.ShuttingDown: {
                Writer.Close();
                break;
            }
            }
        }
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            _nodeState = message.State;
            if (_subsystemState == SubsystemState.NotReady)
            {
                return;
            }

            if (_nodeState == VNodeState.Leader)
            {
                StartComponents();
                return;
            }

            if (_nodeState == VNodeState.Follower || _nodeState == VNodeState.ReadOnlyReplica)
            {
                PublishInitialized();
            }
            StopComponents();
        }
Example #18
0
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            _state = message.State;

            if (message.State == VNodeState.PreLeader)
            {
                _preLeaderReplicationEnabled = false;
                _noQuorumTimestamp           = TimeSpan.Zero;
            }

            if (message.State == VNodeState.Leader)
            {
                _noQuorumTimestamp = TimeSpan.Zero;
            }

            if (message.State == VNodeState.ShuttingDown)
            {
                _stop = true;
            }
        }
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            if ((_statsStorage & StatsStorage.Stream) == 0)
            {
                return;
            }

            if (_statsStreamCreated)
            {
                return;
            }

            switch (message.State)
            {
            case VNodeState.CatchingUp:
            case VNodeState.Clone:
            case VNodeState.Slave:
            case VNodeState.Master: {
                SetStatsStreamMetadata();
                break;
            }
            }
        }
Example #20
0
        public void Handle(SystemMessage.StateChangeMessage message)
        {
            if ((_statsStorage & StatsStorage.Stream) == 0)
            {
                return;
            }

            if (_statsStreamCreated)
            {
                return;
            }

            switch (message.State)
            {
            case VNodeState.CatchingUp:
            case VNodeState.Clone:
            case VNodeState.Follower:
            case VNodeState.ReadOnlyReplica:
            case VNodeState.Leader: {
                SetStatsStreamMetadata();
                break;
            }
            }
        }
Example #21
0
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     DebugLogger.Log();
     DebugLogger.Log();
     DebugLogger.Log();
     DebugLogger.Log("=======================" + message.State + "================");
     if (message.State == VNodeState.Master || // || message.State == VNodeState.Clone
         message.State == VNodeState.Slave)
     {
         if (!_started)
         {
             DebugLogger.Log("*** STARTING PROJECTION CORE ***");
             Start();
         }
     }
     else
     {
         if (_started)
         {
             DebugLogger.Log("*** STOPPING PROJECTION CORE ***");
             Stop();
         }
     }
 }
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     _nodeState = message.State;
 }
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     //TODO(clc): if we have become resigning leader should all requests be actively disposed?
     _nodeState = message.State;
 }
Example #24
0
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     _currentState = message.State;
     _epochId      = GetEpochIdFromStateChange(message);
     StartWhenConditionsAreMet();
 }
 public void Handle(SystemMessage.StateChangeMessage message)
 {
     _currentState = message.State;
     StartWhenConditionsAreMet();
 }
Example #26
0
 void IHandle <SystemMessage.StateChangeMessage> .Handle(SystemMessage.StateChangeMessage message)
 {
     _state = message.State;
 }