Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public RaftState build() throws java.io.IOException
        public virtual RaftState Build()
        {
            StateStorage <TermState> termStore  = new InMemoryStateStorage <TermState>(new TermState());
            StateStorage <VoteState> voteStore  = new InMemoryStateStorage <VoteState>(new VoteState());
            StubMembership           membership = new StubMembership(_votingMembers, _replicationMembers);

            RaftState state = new RaftState(MyselfConflict, termStore, membership, _entryLog, voteStore, new ConsecutiveInFlightCache(), NullLogProvider.Instance, _supportPreVoting, _refusesToBeLeader);

            ICollection <Org.Neo4j.causalclustering.core.consensus.RaftMessages_Directed> noMessages = Collections.emptyList();
            IList <RaftLogCommand> noLogCommands = Collections.emptyList();

            state.Update(new Outcome(null, TermConflict, LeaderConflict, LeaderCommitConflict, _votedFor, _votesForMe, _preVotesForMe, _lastLogIndexBeforeWeBecameLeader, _followerStates, false, noLogCommands, noMessages, emptySet(), CommitIndexConflict, emptySet(), _isPreElection));

            return(state);
        }
Пример #2
0
 private void InitializeInstanceFields()
 {
     _termStateStorage = new InMemoryStateStorage <TermState>(_termState);
     _term             = _termState.currentTerm();
     _retryTimeMillis  = _electionTimeout / 2;
 }