コード例 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void commit(ClusterState clusterState, org.neo4j.causalclustering.identity.MemberId member, long commitIndex) throws java.io.IOException
        private void Commit(ClusterState clusterState, MemberId member, long commitIndex)
        {
            ComparableRaftState state   = clusterState.States[member];
            Outcome             outcome = new Outcome(clusterState.Roles[member], state);

            outcome.CommitIndex = commitIndex;
            state.Update(outcome);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void twoIdenticalStatesShouldBeEqual()
        public virtual void TwoIdenticalStatesShouldBeEqual()
        {
            // given
            NullLogProvider     logProvider = NullLogProvider.Instance;
            ComparableRaftState state1      = new ComparableRaftState(member(0), asSet(member(0), member(1), member(2)), asSet(member(0), member(1), member(2)), false, new InMemoryRaftLog(), new ConsecutiveInFlightCache(), logProvider);

            ComparableRaftState state2 = new ComparableRaftState(member(0), asSet(member(0), member(1), member(2)), asSet(member(0), member(1), member(2)), false, new InMemoryRaftLog(), new ConsecutiveInFlightCache(), logProvider);

            // then
            assertEquals(state1, state2);
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ClusterState(java.util.Set<org.neo4j.causalclustering.identity.MemberId> members) throws java.io.IOException
        public ClusterState(ISet <MemberId> members)
        {
            this.Roles  = new Dictionary <MemberId, Role>();
            this.States = new Dictionary <MemberId, ComparableRaftState>();
            this.Queues = new Dictionary <MemberId, LinkedList <Org.Neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage> >();

            foreach (MemberId member in members)
            {
                Roles[member] = Role.FOLLOWER;
                RaftState memberState = raftState().myself(member).votingMembers(members).build();
                States[member] = new ComparableRaftState(memberState);
                Queues[member] = new LinkedList <Org.Neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage>();
            }
        }
コード例 #4
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            ComparableRaftState that = ( ComparableRaftState )o;

            return(Objects.Equals(TermConflict, that.TermConflict) && Objects.Equals(_lastLogIndexBeforeWeBecameLeader, that._lastLogIndexBeforeWeBecameLeader) && Objects.Equals(MyselfConflict, that.MyselfConflict) && Objects.Equals(_votingMembers, that._votingMembers) && Objects.Equals(LeaderConflict, that.LeaderConflict) && Objects.Equals(_leaderCommit, that._leaderCommit) && Objects.Equals(EntryLogConflict, that.EntryLogConflict) && Objects.Equals(_votedFor, that._votedFor) && Objects.Equals(_votesForMe, that._votesForMe) && Objects.Equals(_followerStates, that._followerStates));
        }