Пример #1
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            RaftMembershipState that = ( RaftMembershipState )o;

            return(_ordinal == that._ordinal && Objects.Equals(_committed, that._committed) && Objects.Equals(_appended, that._appended));
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMarshalCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMarshalCorrectly()
        {
            // given
            RaftMembershipState.Marshal marshal = new RaftMembershipState.Marshal();
            _state = new RaftMembershipState(5, new MembershipEntry(7, _membersA), new MembershipEntry(8, _membersB));

            // when
            ByteBuf buffer = Unpooled.buffer(1_000);

            marshal.MarshalConflict(_state, new BoundedNetworkWritableChannel(buffer));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final RaftMembershipState recovered = marshal.unmarshal(new org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4(buffer));
            RaftMembershipState recovered = marshal.unmarshal(new NetworkReadableClosableChannelNetty4(buffer));

            // then
            assertEquals(_state, recovered);
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start() throws java.io.IOException
        public override void Start()
        {
            this._state = _storage.InitialState;
            long recoverFromIndex = _recoverFromIndexSupplier.AsLong;

            _log.info("Membership state before recovery: " + _state);
            _log.info("Recovering from: " + recoverFromIndex + " to: " + _raftLog.appendIndex());

            using (RaftLogCursor cursor = _raftLog.getEntryCursor(recoverFromIndex))
            {
                while (cursor.Next())
                {
                    Append(cursor.Index(), cursor.get());
                }
            }

            _log.info("Membership state after recovery: " + _state);
            UpdateMemberSets();
        }
Пример #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void install(MembershipEntry committed) throws java.io.IOException
        public virtual void Install(MembershipEntry committed)
        {
            _state = new RaftMembershipState(committed.LogIndex(), committed, null);
            _storage.persistStoreData(_state);
            UpdateMemberSets();
        }