Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private ContentBuilder<org.neo4j.causalclustering.core.replication.ReplicatedContent> unmarshal(byte contentType, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        private ContentBuilder <ReplicatedContent> Unmarshal(sbyte contentType, ReadableChannel channel)
        {
            switch (contentType)
            {
            case TX_CONTENT_TYPE:
                return(ContentBuilder.Finished(ReplicatedTransactionSerializer.unmarshal(channel)));

            case RAFT_MEMBER_SET_TYPE:
                return(ContentBuilder.Finished(MemberIdSetSerializer.unmarshal(channel)));

            case ID_RANGE_REQUEST_TYPE:
                return(ContentBuilder.Finished(ReplicatedIdAllocationRequestSerializer.unmarshal(channel)));

            case TOKEN_REQUEST_TYPE:
                return(ContentBuilder.Finished(ReplicatedTokenRequestSerializer.unmarshal(channel)));

            case NEW_LEADER_BARRIER_TYPE:
                return(ContentBuilder.Finished(new NewLeaderBarrier()));

            case LOCK_TOKEN_REQUEST:
                return(ContentBuilder.Finished(ReplicatedLockTokenSerializer.unmarshal(channel)));

            case DISTRIBUTED_OPERATION:
            {
                return(DistributedOperation.deserialize(channel));
            }

            case DUMMY_REQUEST:
                return(ContentBuilder.Finished(DummyRequest.Marshal.INSTANCE.unmarshal(channel)));

            default:
                throw new System.InvalidOperationException("Not a recognized content type: " + contentType);
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMarshalTokenRequest() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMarshalTokenRequest()
        {
            ByteBuf buffer = Unpooled.buffer();

            List <StorageCommand> commands = new List <StorageCommand>();
            LabelTokenRecord      before   = new LabelTokenRecord(0);
            LabelTokenRecord      after    = new LabelTokenRecord(0);

            after.InUse = true;
            after.SetCreated();
            after.NameId = 3232;
            commands.Add(new Command.LabelTokenCommand(before, after));
            ReplicatedContent message = new ReplicatedTokenRequest(TokenType.LABEL, "theLabel", ReplicatedTokenRequestSerializer.commandBytes(commands));

            AssertMarshalingEquality(buffer, message);
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void handle(org.neo4j.causalclustering.core.state.machines.token.ReplicatedTokenRequest replicatedTokenRequest) throws java.io.IOException
            public override void Handle(ReplicatedTokenRequest replicatedTokenRequest)
            {
                WritableChannel.put(TOKEN_REQUEST_TYPE);
                ReplicatedTokenRequestSerializer.marshal(replicatedTokenRequest, WritableChannel);
            }
Esempio n. 4
0
 public override void Handle(ReplicatedTokenRequest replicatedTokenRequest)
 {
     Output.Add(ChunkedReplicatedContent.Single(TOKEN_REQUEST_TYPE, channel => ReplicatedTokenRequestSerializer.marshal(replicatedTokenRequest, channel)));
 }