Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ComparableRaftLog(org.neo4j.causalclustering.core.consensus.log.ReadableRaftLog raftLog) throws java.io.IOException
        public ComparableRaftLog(ReadableRaftLog raftLog)
        {
            using (RaftLogCursor cursor = raftLog.GetEntryCursor(0))
            {
                while (cursor.Next())
                {
                    Append(cursor.get());
                }
            }
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.causalclustering.core.consensus.log.RaftLogEntry getUsingCursor(long logIndex) throws java.io.IOException
        private RaftLogEntry GetUsingCursor(long logIndex)
        {
            if (_cursor == null)
            {
                _cursor = _raftLog.getEntryCursor(logIndex);
            }

            if (_cursor.next())
            {
                if (_cursor.index() != logIndex)
                {
                    throw new System.InvalidOperationException(format("expected index %d but was %s", logIndex, _cursor.index()));
                }
                return(_cursor.get());
            }
            else
            {
                return(null);
            }
        }