Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(DummyRequest dummy, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type:
            public override void MarshalConflict(DummyRequest dummy, WritableChannel channel)
            {
                if (dummy._data != null)
                {
                    channel.PutInt(dummy._data.Length);
                    channel.Put(dummy._data, dummy._data.Length);
                }
                else
                {
                    channel.PutInt(0);
                }
            }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void marshal(org.neo4j.storageengine.api.WritableChannel channel, String string) throws java.io.IOException
        public static void Marshal(WritableChannel channel, string @string)
        {
            if (string.ReferenceEquals(@string, null))
            {
                channel.PutInt(NULL_STRING_LENGTH);
            }
            else
            {
                sbyte[] bytes = @string.GetBytes(UTF_8);
                channel.PutInt(bytes.Length);
                channel.Put(bytes, bytes.Length);
            }
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void marshal(org.neo4j.storageengine.api.WritableChannel writableChannel, TransactionRepresentationReplicatedTransaction replicatedTransaction) throws java.io.IOException
        public static void Marshal(WritableChannel writableChannel, TransactionRepresentationReplicatedTransaction replicatedTransaction)
        {
            if (writableChannel is ByteBufBacked)
            {
                /*
                 * Marshals more efficiently if Channel is going over the network. In practice, this means maintaining support for
                 * RaftV1 without loosing performance
                 */
                ByteBuf buffer        = (( ByteBufBacked )writableChannel).byteBuf();
                int     metaDataIndex = buffer.writerIndex();
                int     txStartIndex  = metaDataIndex + Integer.BYTES;
                // leave room for length to be set later.
                buffer.writerIndex(txStartIndex);
                WriteTx(writableChannel, replicatedTransaction.Tx());
                int txLength = buffer.writerIndex() - txStartIndex;
                buffer.setInt(metaDataIndex, txLength);
            }
            else
            {
                /*
                 * Unknown length. This should only be reached in tests. When a ReplicatedTransaction is marshaled to file it has already passed over the network
                 * and is of a different type. More efficient marshalling is used in ByteArrayReplicatedTransaction.
                 */
                MemoryStream outputStream = new MemoryStream(1024);
                OutputStreamWritableChannel outputStreamWritableChannel = new OutputStreamWritableChannel(outputStream);
                WriteTx(outputStreamWritableChannel, replicatedTransaction.Tx());
                int length = outputStream.size();
                writableChannel.PutInt(length);
                writableChannel.Put(outputStream.toByteArray(), length);
            }
        }
Example #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void marshal(org.neo4j.storageengine.api.WritableChannel writableChannel, ByteArrayReplicatedTransaction replicatedTransaction) throws java.io.IOException
        public static void Marshal(WritableChannel writableChannel, ByteArrayReplicatedTransaction replicatedTransaction)
        {
            int length = replicatedTransaction.TxBytes.Length;

            writableChannel.PutInt(length);
            writableChannel.Put(replicatedTransaction.TxBytes, length);
        }
Example #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(org.neo4j.causalclustering.core.replication.ReplicatedContent content, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
        public override void Marshal(ReplicatedContent content, WritableChannel channel)
        {
            if (content is ReplicatedInteger)
            {
                channel.Put(( sbyte )REPLICATED_INTEGER_TYPE);
                channel.PutInt((( ReplicatedInteger )content).get());
            }
            else if (content is ReplicatedString)
            {
                string  value       = (( ReplicatedString )content).get();
                sbyte[] stringBytes = value.GetBytes();
                channel.Put(( sbyte )REPLICATED_STRING_TYPE);
                channel.PutInt(stringBytes.Length);
                channel.Put(stringBytes, stringBytes.Length);
            }
            else
            {
                throw new System.ArgumentException("Unknown content type: " + content);
            }
        }
Example #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(org.neo4j.causalclustering.core.replication.ReplicatedContent content, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
            public override void marshal(ReplicatedContent content, WritableChannel channel)
            {
                if (content is ReplicatedInteger)
                {
                    channel.Put(( sbyte )1);
                    channel.PutInt((( ReplicatedInteger )content).get());
                }
                else
                {
                    throw new System.ArgumentException("Unknown content type " + content.GetType());
                }
            }
Example #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(ReplicatedLockTokenState state, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type:
            public override void MarshalConflict(ReplicatedLockTokenState state, WritableChannel channel)
            {
                channel.PutLong(state._ordinal);
                channel.PutInt(state.Get().id());
                MemberMarshal.marshal(state.Get().owner(), channel);
            }
Example #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(java.util.concurrent.atomic.AtomicInteger state, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
            public override void Marshal(AtomicInteger state, WritableChannel channel)
            {
                channel.PutInt(state.intValue());
            }
Example #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void marshal(ReplicatedLockTokenRequest tokenRequest, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
        public static void Marshal(ReplicatedLockTokenRequest tokenRequest, WritableChannel channel)
        {
            channel.PutInt(tokenRequest.Id());
            (new MemberId.Marshal()).marshal(tokenRequest.Owner(), channel);
        }
Example #10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(FileChunk fileChunk, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type:
            public override void MarshalConflict(FileChunk fileChunk, WritableChannel channel)
            {
                channel.PutInt(fileChunk._encodedLength);
                sbyte[] bytes = fileChunk.Bytes();
                channel.Put(bytes, bytes.Length);
            }