Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static ReplicatedLockTokenRequest unmarshal(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        public static ReplicatedLockTokenRequest Unmarshal(ReadableChannel channel)
        {
            int      candidateId = channel.Int;
            MemberId owner       = (new MemberId.Marshal()).unmarshal(channel);

            return(new ReplicatedLockTokenRequest(owner, candidateId));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.causalclustering.core.replication.ReplicatedContent unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            public override ReplicatedContent unmarshal0(ReadableChannel channel)
            {
                sbyte type = channel.Get();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.core.replication.ReplicatedContent content;
                ReplicatedContent content;

                switch (type)
                {
                case 1:
                    content = ReplicatedInteger.valueOf(channel.Int);
                    break;

                default:
                    throw new System.ArgumentException(string.Format("Unknown content type 0x{0:x}", type));
                }

                try
                {
                    channel.Get();
                    throw new System.ArgumentException("Bytes remain in buffer after deserialization");
                }
                catch (ReadPastEndException)
                {
                    // expected
                }
                return(content);
            }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ReplicatedLockTokenState unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
            public override ReplicatedLockTokenState Unmarshal0(ReadableChannel channel)
            {
                long     logIndex    = channel.Long;
                int      candidateId = channel.Int;
                MemberId member      = MemberMarshal.unmarshal(channel);

                return(new ReplicatedLockTokenState(logIndex, new ReplicatedLockTokenRequest(member, candidateId)));
            }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static ReplicatedTransaction unmarshal(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        public static ReplicatedTransaction Unmarshal(ReadableChannel channel)
        {
            int txBytesLength = channel.Int;

            sbyte[] txBytes = new sbyte[txBytesLength];
            channel.Get(txBytes, txBytesLength);
            return(ReplicatedTransaction.from(txBytes));
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected FileChunk unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            protected internal override FileChunk Unmarshal0(ReadableChannel channel)
            {
                int encodedLength = channel.Int;
                int length        = encodedLength == USE_MAX_SIZE_AND_EXPECT_MORE_CHUNKS ? MAX_SIZE : encodedLength;

                sbyte[] bytes = new sbyte[length];
                channel.Get(bytes, length);
                return(new FileChunk(encodedLength, bytes));
            }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public SegmentHeader unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            public override SegmentHeader Unmarshal0(ReadableChannel channel)
            {
                long prevFileLastIndex = channel.Long;
                long version           = channel.Long;
                long prevIndex         = channel.Long;
                long prevTerm          = channel.Long;

                return(new SegmentHeader(prevFileLastIndex, version, prevIndex, prevTerm));
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static org.neo4j.storageengine.api.ReadableChannel channelWithRelGroupRecord(long id, byte inUse, short type, long next, long firstOut, long firstIn, long firstLoop, long owningNode) throws java.io.IOException
        private static ReadableChannel ChannelWithRelGroupRecord(long id, sbyte inUse, short type, long next, long firstOut, long firstIn, long firstLoop, long owningNode)
        {
            ReadableChannel channel = mock(typeof(ReadableChannel));

            when(channel.Get()).thenReturn(NeoCommandType_Fields.RelGroupCommand).thenReturn(inUse);
            when(channel.Long).thenReturn(id).thenReturn(next).thenReturn(firstOut).thenReturn(firstIn).thenReturn(firstLoop).thenReturn(owningNode);
            when(channel.Short).thenReturn(type);

            return(channel);
        }
Exemplo n.º 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public VoteState unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
            public override VoteState Unmarshal0(ReadableChannel channel)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long term = channel.getLong();
                long term = channel.Long;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.causalclustering.identity.MemberId member = memberMarshal.unmarshal(channel);
                MemberId member = MemberMarshal.unmarshal(channel);

                return(new VoteState(member, term));
            }
Exemplo n.º 9
0
        /// <summary>
        /// Handles format back to 1.9 where the command format didn't have a version.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public final Command read(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        public override Command Read(ReadableChannel channel)
        {
            sbyte commandType;

            do
            {
                commandType = channel.Get();
            } while (commandType == NeoCommandType_Fields.None);

            return(Read(commandType, channel));
        }
Exemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public final STATE unmarshal(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        public override STATE Unmarshal(ReadableChannel channel)
        {
            try
            {
                return(Unmarshal0(channel));
            }
            catch (ReadPastEndException e)
            {
                throw new EndOfStreamException(e);
            }
        }
Exemplo n.º 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static org.neo4j.causalclustering.messaging.marshalling.ContentBuilder<ReplicatedContent> deserialize(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        public static ContentBuilder <ReplicatedContent> Deserialize(ReadableChannel channel)
        {
            long          mostSigBits   = channel.Long;
            long          leastSigBits  = channel.Long;
            MemberId      owner         = (new MemberId.Marshal()).unmarshal(channel);
            GlobalSession globalSession = new GlobalSession(new System.Guid(mostSigBits, leastSigBits), owner);

            long             localSessionId   = channel.Long;
            long             sequenceNumber   = channel.Long;
            LocalOperationId localOperationId = new LocalOperationId(localSessionId, sequenceNumber);

            return(ContentBuilder.unfinished(subContent => new DistributedOperation(subContent, globalSession, localOperationId)));
        }
Exemplo n.º 12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public IdAllocationState unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            public override IdAllocationState Unmarshal0(ReadableChannel channel)
            {
                long[] firstNotAllocated = new long[( int )channel.Long];

                for (int i = 0; i < firstNotAllocated.Length; i++)
                {
                    firstNotAllocated[i] = channel.Long;
                }

                long logIndex = channel.Long;

                return(new IdAllocationState(firstNotAllocated, logIndex));
            }
Exemplo n.º 13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected java.io.IOException unknownCommandType(byte commandType, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        protected internal virtual IOException UnknownCommandType(sbyte commandType, ReadableChannel channel)
        {
            string message = "Unknown command type[" + commandType + "]";

            if (channel is PositionAwareChannel)
            {
                PositionAwareChannel logChannel = ( PositionAwareChannel )channel;
                LogPositionMarker    position   = new LogPositionMarker();
                logChannel.GetCurrentPosition(position);
                message += " near " + position.NewPosition();
            }
            return(new IOException(message));
        }
Exemplo n.º 14
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);
            }
        }
Exemplo n.º 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static String unmarshal(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        public static string Unmarshal(ReadableChannel channel)
        {
            int len = channel.Int;

            if (len == NULL_STRING_LENGTH)
            {
                return(null);
            }

            sbyte[] stringBytes = new sbyte[len];
            channel.Get(stringBytes, stringBytes.Length);

            return(StringHelper.NewString(stringBytes, UTF_8));
        }
Exemplo n.º 16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected DummyRequest unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            protected internal override DummyRequest Unmarshal0(ReadableChannel channel)
            {
                int length = channel.Int;

                sbyte[] data;
                if (length > 0)
                {
                    data = new sbyte[length];
                    channel.Get(data, length);
                }
                else
                {
                    data = null;
                }
                return(new DummyRequest(data));
            }
Exemplo n.º 17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected org.neo4j.causalclustering.core.replication.ReplicatedContent unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        protected internal override ReplicatedContent Unmarshal0(ReadableChannel channel)
        {
            sbyte type = channel.Get();

            switch (type)
            {
            case REPLICATED_INTEGER_TYPE:
                return(ReplicatedInteger.valueOf(channel.Int));

            case REPLICATED_STRING_TYPE:
                int     length = channel.Int;
                sbyte[] bytes  = new sbyte[length];
                channel.Get(bytes, length);
                return(ReplicatedString.valueOf(StringHelper.NewString(bytes)));

            default:
                throw new System.ArgumentException("Unknown content type: " + type);
            }
        }
Exemplo n.º 18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected org.neo4j.causalclustering.identity.StoreId unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        protected internal override StoreId Unmarshal0(ReadableChannel channel)
        {
            sbyte exists = channel.Get();

            if (exists == 0)
            {
                return(null);
            }
            else if (exists != 1)
            {
                throw new DecoderException("Unexpected value: " + exists);
            }

            long creationTime = channel.Long;
            long randomId     = channel.Long;
            long upgradeTime  = channel.Long;
            long upgradeId    = channel.Long;

            return(new StoreId(creationTime, randomId, upgradeTime, upgradeId));
        }
Exemplo n.º 19
0
 internal ReadableChannelPageCursor(ReadableChannel channel)
 {
     this._channel = channel;
 }
Exemplo n.º 20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected TermState unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            protected internal override TermState Unmarshal0(ReadableChannel channel)
            {
                return(new TermState(channel.Long));
            }
Exemplo n.º 21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static boolean unmarshal(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        public static bool Unmarshal(ReadableChannel channel)
        {
            return(channel.Get() != 0);
        }
Exemplo n.º 22
0
        /// <summary>
        /// The specific implementation of unmarshal which does not have to deal
        /// with the IOException <seealso cref="ReadPastEndException"/> and can safely throw
        /// the checked EndOfStreamException.
        /// </summary>
        /// <param name="channel"> The channel to read from. </param>
        /// <returns> An unmarshalled object. </returns>
        /// <exception cref="IOException"> </exception>
        /// <exception cref="EndOfStreamException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected abstract STATE unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException;
        protected internal abstract STATE Unmarshal0(ReadableChannel channel);
Exemplo n.º 23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected System.Nullable<long> unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        protected internal override long?Unmarshal0(ReadableChannel channel)
        {
            return(channel.Long);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Reads the next <seealso cref="Command"/> from {@code channel}.
        /// </summary>
        /// <param name="commandType"> type of command to read, f.ex. node command, relationship command a.s.o. </param>
        /// <param name="channel">     <seealso cref="ReadableClosableChannel"/> to read from. </param>
        /// <returns> <seealso cref="Command"/> or {@code null} if end reached. </returns>
        /// <exception cref="IOException"> if channel throws exception. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected abstract Command read(byte commandType, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException;
        protected internal abstract Command Read(sbyte commandType, ReadableChannel channel);
Exemplo n.º 25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected DatabaseName unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            protected internal override DatabaseName Unmarshal0(ReadableChannel channel)
            {
                return(new DatabaseName(StringMarshal.unmarshal(channel)));
            }
Exemplo n.º 26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public java.util.concurrent.atomic.AtomicInteger unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            public override AtomicInteger Unmarshal0(ReadableChannel channel)
            {
                return(new AtomicInteger(channel.Int));
            }