コード例 #1
0
        protected virtual void SelectNewMasterOnTopologyChanged(object sender, NodeMetadata nodeMetadata)
        {
            if (nodeMetadata.ChangeType == TopologyChangeType.MasterSelected)
            {
                return;                    //nothing to do here
            }
            MasterSelectedByQuorum = null; // Who is the master is in doubt, because the topology changed

            var others   = topologyState.Keys.ToArray();
            var acceptor = new Acceptor(this, myAddress, others);
            var proposer = new Proposer(this, acceptor, myAddress, others);
            var learner  = new Learner(this, others);

            learner.OnAcceptedValue += LearnerOnOnAcceptedValue;
            agents = new Agent[] { acceptor, proposer, learner };

            proposer.StartProposing(new SwitchMasterCommand
            {
                NewMaster = others.OrderBy(x => x.AbsoluteUri).First()
            });
        }
		protected override void SelectNewMasterOnTopologyChanged(object sender, NodeMetadata nodeMetadata)
		{
			// we don't handle master selection
		}
コード例 #3
0
		protected virtual void SelectNewMasterOnTopologyChanged(object sender, NodeMetadata nodeMetadata)
		{
			if (nodeMetadata.ChangeType == TopologyChangeType.MasterSelected)
				return;//nothing to do here

			MasterSelectedByQuorum = null; // Who is the master is in doubt, because the topology changed

			var others = topologyState.Keys.ToArray();
			var acceptor = new Acceptor(this, myAddress, others);
			var proposer = new Proposer(this, acceptor, myAddress, others);
			var learner = new Learner(this, others);
			learner.OnAcceptedValue += LearnerOnOnAcceptedValue;
			agents = new Agent[] { acceptor, proposer, learner };

			proposer.StartProposing(new SwitchMasterCommand
			{
				NewMaster = others.OrderBy(x => x.AbsoluteUri).First()
			});
		}
コード例 #4
0
 protected override void SelectNewMasterOnTopologyChanged(object sender, NodeMetadata nodeMetadata)
 {
     // we don't handle master selection
 }