Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static EntryRecord read(org.neo4j.storageengine.api.ReadableChannel channel, org.neo4j.causalclustering.messaging.marshalling.ChannelMarshal<org.neo4j.causalclustering.core.replication.ReplicatedContent> contentMarshal) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        public static EntryRecord Read(ReadableChannel channel, ChannelMarshal <ReplicatedContent> contentMarshal)
        {
            try
            {
                long appendIndex          = channel.Long;
                long term                 = channel.Long;
                ReplicatedContent content = contentMarshal.Unmarshal(channel);
                return(new EntryRecord(appendIndex, new RaftLogEntry(term, content)));
            }
            catch (ReadPastEndException e)
            {
                throw new EndOfStreamException(e);
            }
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void contentEquals(org.neo4j.causalclustering.core.replication.ReplicatedContent one, org.neo4j.causalclustering.core.replication.ReplicatedContent two) throws Exception
        private void ContentEquals(ReplicatedContent one, ReplicatedContent two)
        {
            if (one is ReplicatedTransaction)
            {
                ByteBuf buffer1 = Unpooled.buffer();
                ByteBuf buffer2 = Unpooled.buffer();
                Encode(buffer1, (( ReplicatedTransaction )one).encode());
                Encode(buffer2, (( ReplicatedTransaction )two).encode());
                assertEquals(buffer1, buffer2);
            }
            else if (one is DistributedOperation)
            {
                assertEquals((( DistributedOperation )one).globalSession(), ((DistributedOperation)two).globalSession());
                assertEquals((( DistributedOperation )one).operationId(), ((DistributedOperation)two).operationId());
                ContentEquals((( DistributedOperation )one).content(), ((DistributedOperation)two).content());
            }
            else
            {
                assertEquals(one, two);
            }
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void write(org.neo4j.storageengine.api.WritableChannel channel, org.neo4j.causalclustering.messaging.marshalling.ChannelMarshal<org.neo4j.causalclustering.core.replication.ReplicatedContent> contentMarshal, long logIndex, long term, org.neo4j.causalclustering.core.replication.ReplicatedContent content) throws java.io.IOException
        public static void Write(WritableChannel channel, ChannelMarshal <ReplicatedContent> contentMarshal, long logIndex, long term, ReplicatedContent content)
        {
            channel.PutLong(logIndex);
            channel.PutLong(term);
            contentMarshal.Marshal(content, channel);
        }
Example #4
0
 public RaftLogEntry(long term, ReplicatedContent content)
 {
     Objects.requireNonNull(content);
     this._term    = term;
     this._content = content;
 }