Ejemplo n.º 1
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);
        }
Ejemplo n.º 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 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);
            }
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(SegmentHeader header, 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(SegmentHeader header, WritableChannel channel)
            {
                channel.PutLong(header._prevFileLastIndex);
                channel.PutLong(header._version);
                channel.PutLong(header._prevIndex);
                channel.PutLong(header._prevTerm);
            }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void writeTx(org.neo4j.storageengine.api.WritableChannel writableChannel, org.neo4j.kernel.impl.transaction.TransactionRepresentation tx) throws java.io.IOException
        private static void WriteTx(WritableChannel writableChannel, TransactionRepresentation tx)
        {
            ReplicatedTransactionFactory.TransactionRepresentationWriter txWriter = transactionalRepresentationWriter(tx);
            while (txWriter.CanWrite())
            {
                txWriter.Write(writableChannel);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This this consumer ignores the content which is handles by its own serializer.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshalMetaData(org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
        public virtual void MarshalMetaData(WritableChannel channel)
        {
            channel.PutLong(GlobalSession().sessionId().MostSignificantBits);
            channel.PutLong(GlobalSession().sessionId().LeastSignificantBits);
            (new MemberId.Marshal()).marshal(GlobalSession().owner(), channel);

            channel.PutLong(_operationId.localSessionId());
            channel.PutLong(_operationId.sequenceNumber());
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(IdAllocationState 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(IdAllocationState state, WritableChannel channel)
            {
                channel.PutLong(( long )state._firstUnallocated.Length);
                foreach (long l in state._firstUnallocated)
                {
                    channel.PutLong(l);
                }

                channel.PutLong(state._logIndex);
            }
Ejemplo n.º 7
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());
                }
            }
Ejemplo n.º 8
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);
                }
            }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(org.neo4j.causalclustering.identity.StoreId storeId, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
        public override void Marshal(StoreId storeId, WritableChannel channel)
        {
            if (storeId == null)
            {
                channel.Put(( sbyte )0);
                return;
            }

            channel.Put(( sbyte )1);
            channel.PutLong(storeId.CreationTime);
            channel.PutLong(storeId.RandomId);
            channel.PutLong(storeId.UpgradeTime);
            channel.PutLong(storeId.UpgradeId);
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
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, boolean value) throws java.io.IOException
        public static void Marshal(WritableChannel channel, bool value)
        {
            channel.Put(( sbyte )(value ? 1 : 0));
        }
Ejemplo n.º 13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(org.neo4j.storageengine.api.WritableChannel writableChannel) throws java.io.IOException
		 public override void Marshal( WritableChannel writableChannel )
		 {
			  ReplicatedTransactionSerializer.Marshal( writableChannel, this );
		 }
Ejemplo n.º 14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(System.Nullable<long> index, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
        public override void Marshal(long?index, WritableChannel channel)
        {
            channel.PutLong(index.Value);
        }
Ejemplo n.º 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(System.Nullable<long> aLong, org.neo4j.storageengine.api.WritableChannel channel) throws java.io.IOException
            public override void Marshal(long?aLong, WritableChannel channel)
            {
                channel.PutLong(aLong.Value);
            }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(VoteState 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(VoteState state, WritableChannel channel)
            {
                channel.PutLong(state._term);
                MemberMarshal.marshal(state.VotedFor(), channel);
            }
Ejemplo n.º 18
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);
            }
Ejemplo n.º 19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(DatabaseName databaseName, 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(DatabaseName databaseName, WritableChannel channel)
            {
                StringMarshal.marshal(channel, databaseName.Name());
            }
Ejemplo n.º 20
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);
            }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
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());
            }
Ejemplo n.º 23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void marshal(TermState termState, 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(TermState termState, WritableChannel channel)
            {
                channel.PutLong(termState.CurrentTerm());
            }
Ejemplo n.º 24
0
 public override abstract void Marshal(STATE state, Org.Neo4j.Storageengine.Api.WritableChannel channel);
Ejemplo n.º 25
0
 public StorageCommandSerializer(WritableChannel channel)
 {
     this._channel = channel;
 }