Beispiel #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);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitNeoStoreCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitNeoStoreCommand(ReadableChannel channel)
        {
            NeoStoreRecord before = ReadNeoStoreRecord(channel);
            NeoStoreRecord after  = ReadNeoStoreRecord(channel);

            return(new Command.NeoStoreCommand(before, after));
        }
Beispiel #3
0
 public LongPollingTransport(CancellationToken timeoutToken, ReadableChannel <byte[]> application, string connectionId, ILoggerFactory loggerFactory)
 {
     _timeoutToken = timeoutToken;
     _application  = application;
     _connectionId = connectionId;
     _logger       = loggerFactory.CreateLogger <LongPollingTransport>();
 }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitNodeCountsCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitNodeCountsCommand(ReadableChannel channel)
        {
            int  labelId = channel.Int;
            long delta   = channel.Long;

            return(new Command.NodeCountsCommand(labelId, delta));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitRelationshipTypeTokenCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitRelationshipTypeTokenCommand(ReadableChannel channel)
        {
            // id+in_use(byte)+type_blockId(int)+nr_type_records(int)
            int   id        = channel.Int;
            sbyte inUseFlag = channel.Get();
            bool  inUse     = false;

            if ((inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue())
            {
                inUse = true;
            }
            else if (inUseFlag != Record.NOT_IN_USE.byteValue())
            {
                throw new IOException("Illegal in use flag: " + inUseFlag);
            }
            RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord(id);

            record.InUse  = inUse;
            record.NameId = channel.Int;
            int nrTypeRecords = channel.Int;

            for (int i = 0; i < nrTypeRecords; i++)
            {
                DynamicRecord dr = ReadDynamicRecord(channel);
                if (dr == null)
                {
                    return(null);
                }
                record.AddNameRecord(dr);
            }
            return(new Command.RelationshipTypeTokenCommand(null, record));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Object readIndexValue(byte valueType, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private object ReadIndexValue(sbyte valueType, ReadableChannel channel)
        {
            switch (valueType)
            {
            case IndexCommand.VALUE_TYPE_NULL:
                return(null);

            case IndexCommand.VALUE_TYPE_SHORT:
                return(channel.Short);

            case IndexCommand.VALUE_TYPE_INT:
                return(channel.Int);

            case IndexCommand.VALUE_TYPE_LONG:
                return(channel.Long);

            case IndexCommand.VALUE_TYPE_FLOAT:
                return(channel.Float);

            case IndexCommand.VALUE_TYPE_DOUBLE:
                return(channel.Double);

            case IndexCommand.VALUE_TYPE_STRING:
                return(read3bLengthAndString(channel));

            default:
                throw new Exception("Unknown value type " + valueType);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.PropertyBlock readPropertyBlock(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private PropertyBlock ReadPropertyBlock(ReadableChannel channel)
        {
            PropertyBlock toReturn  = new PropertyBlock();
            sbyte         blockSize = channel.Get();       // the size is stored in bytes // 1

            Debug.Assert(blockSize > 0 && blockSize % 8 == 0, blockSize + " is not a valid block size value");
            // Read in blocks
            long[] blocks = ReadLongs(channel, blockSize / 8);
            Debug.Assert(blocks.Length == blockSize / 8, blocks.Length + " longs were read in while i asked for what corresponds to " + blockSize);

            Debug.Assert(PropertyType.getPropertyTypeOrThrow(blocks[0]).calculateNumberOfBlocksUsed(blocks[0]) == blocks.Length, blocks.Length + " is not a valid number of blocks for type ");
            +PropertyType.getPropertyTypeOrThrow(blocks[0]);

            /*
             *  Ok, now we may be ready to return, if there are no DynamicRecords. So
             *  we start building the Object
             */
            toReturn.ValueBlocks = blocks;

            /*
             * Read in existence of DynamicRecords. Remember, this has already been
             * read in the buffer with the blocks, above.
             */
            if (ReadDynamicRecords(channel, toReturn, PROPERTY_BLOCK_DYNAMIC_RECORD_ADDER) == -1)
            {
                return(null);
            }
            return(toReturn);
        }
        public DispatchContext Case <T>(ReadableChannel <T> channel, Func <T, Task> callback, Func <T, bool> additionalAcceptanceTest = null)
        {
            var task = ProcessCaseAsync <T>(channel, callback, additionalAcceptanceTest ?? AcceptAlways);

            tasksToShutdown.Enqueue(task);
            return(this);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.NodeRecord readNodeRecord(long id, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private NodeRecord ReadNodeRecord(long id, ReadableChannel channel)
        {
            sbyte flags = channel.Get();
            bool  inUse = bitFlag(flags, Record.IN_USE.byteValue());
            bool  requiresSecondaryUnit    = bitFlag(flags, Record.REQUIRE_SECONDARY_UNIT);
            bool  hasSecondaryUnit         = bitFlag(flags, Record.HAS_SECONDARY_UNIT);
            bool  usesFixedReferenceFormat = bitFlag(flags, Record.USES_FIXED_REFERENCE_FORMAT);

            NodeRecord record;
            ICollection <DynamicRecord> dynamicLabelRecords = new List <DynamicRecord>();
            long labelField = Record.NO_LABELS_FIELD.intValue();

            if (inUse)
            {
                bool dense = channel.Get() == 1;
                record = new NodeRecord(id, dense, channel.Long, channel.Long);
                // labels
                labelField = channel.Long;
                record.RequiresSecondaryUnit = requiresSecondaryUnit;
                if (hasSecondaryUnit)
                {
                    record.SecondaryUnitId = channel.Long;
                }
                record.UseFixedReferences = usesFixedReferenceFormat;
            }
            else
            {
                record = new NodeRecord(id);
            }
            ReadDynamicRecords(channel, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER);
            record.SetLabelField(labelField, dynamicLabelRecords);
            record.InUse = inUse;
            return(record);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.DynamicRecord readDynamicRecord(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private DynamicRecord ReadDynamicRecord(ReadableChannel channel)
        {
            // id+type+in_use(byte)+nr_of_bytes(int)+next_block(long)
            long id = channel.Long;

            Debug.Assert(id >= 0 && id <= (1L << 36) - 1, id + " is not a valid dynamic record id");
            int           type      = channel.Int;
            sbyte         inUseFlag = channel.Get();
            bool          inUse     = (inUseFlag & Record.IN_USE.byteValue()) != 0;
            DynamicRecord record    = new DynamicRecord(id);

            record.SetInUse(inUse, type);
            if (inUse)
            {
                record.StartRecord = (inUseFlag & Record.FIRST_IN_CHAIN.byteValue()) != 0;
                int nrOfBytes = channel.Int;
                Debug.Assert(nrOfBytes >= 0 && nrOfBytes < ((1 << 24) - 1), nrOfBytes + " is not valid for a number of bytes field of " + "a dynamic record");
                long nextBlock = channel.Long;
                assert(nextBlock >= 0 && nextBlock <= (1L << 36 - 1)) || (nextBlock == Record.NO_NEXT_BLOCK.intValue()) : nextBlock + " is not valid for a next record field of " + "a dynamic record";
                record.NextBlock = nextBlock;
                sbyte[] data = new sbyte[nrOfBytes];
                channel.Get(data, nrOfBytes);
                record.Data = data;
            }
            return(record);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.LabelTokenRecord readLabelTokenRecord(int id, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private LabelTokenRecord ReadLabelTokenRecord(int id, ReadableChannel channel)
        {
            // in_use(byte)+type_blockId(int)+nr_type_records(int)
            sbyte inUseFlag = channel.Get();
            bool  inUse     = false;

            if ((inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue())
            {
                inUse = true;
            }
            else if (inUseFlag != Record.NOT_IN_USE.byteValue())
            {
                throw new IOException("Illegal in use flag: " + inUseFlag);
            }
            LabelTokenRecord record = new LabelTokenRecord(id);

            record.InUse  = inUse;
            record.NameId = channel.Int;
            int nrTypeRecords = channel.Int;

            for (int i = 0; i < nrTypeRecords; i++)
            {
                DynamicRecord dr = ReadDynamicRecord(channel);
                if (dr == null)
                {
                    return(null);
                }
                record.AddNameRecord(dr);
            }
            return(record);
        }
Beispiel #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static String readString(org.neo4j.storageengine.api.ReadableChannel channel, int length) throws java.io.IOException
        public static string ReadString(ReadableChannel channel, int length)
        {
            Debug.Assert(length >= 0, "invalid array length " + length);
            sbyte[] chars = new sbyte[length];
            channel.Get(chars, length);
            return(UTF8.decode(chars));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord readPropertyKeyTokenRecord(int id, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private PropertyKeyTokenRecord ReadPropertyKeyTokenRecord(int id, ReadableChannel channel)
        {
            // in_use(byte)+count(int)+key_blockId(int)
            sbyte inUseFlag = channel.Get();
            bool  inUse     = false;

            if ((inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue())
            {
                inUse = true;
            }
            else if (inUseFlag != Record.NOT_IN_USE.byteValue())
            {
                throw new IOException("Illegal in use flag: " + inUseFlag);
            }
            PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(id);

            record.InUse         = inUse;
            record.PropertyCount = channel.Int;
            record.NameId        = channel.Int;
            if (ReadDynamicRecords(channel, record, PROPERTY_INDEX_DYNAMIC_RECORD_ADDER) == -1)
            {
                return(null);
            }
            return(record);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.RelationshipGroupRecord readRelationshipGroupRecord(long id, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private RelationshipGroupRecord ReadRelationshipGroupRecord(long id, ReadableChannel channel)
        {
            sbyte flags = channel.Get();
            bool  inUse = bitFlag(flags, Record.IN_USE.byteValue());
            bool  requireSecondaryUnit     = bitFlag(flags, Record.REQUIRE_SECONDARY_UNIT);
            bool  hasSecondaryUnit         = bitFlag(flags, Record.HAS_SECONDARY_UNIT);
            bool  usesFixedReferenceFormat = bitFlag(flags, Record.USES_FIXED_REFERENCE_FORMAT);

            int type = unsignedShortToInt(channel.Short);
            RelationshipGroupRecord record = new RelationshipGroupRecord(id, type);

            record.InUse                 = inUse;
            record.Next                  = channel.Long;
            record.FirstOut              = channel.Long;
            record.FirstIn               = channel.Long;
            record.FirstLoop             = channel.Long;
            record.OwningNode            = channel.Long;
            record.RequiresSecondaryUnit = requireSecondaryUnit;
            if (hasSecondaryUnit)
            {
                record.SecondaryUnitId = channel.Long;
            }
            record.UseFixedReferences = usesFixedReferenceFormat;
            return(record);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.NodeRecord readNodeRecord(long id, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private NodeRecord ReadNodeRecord(long id, ReadableChannel channel)
        {
            sbyte inUseFlag = channel.Get();
            bool  inUse     = false;

            if (inUseFlag == Record.IN_USE.byteValue())
            {
                inUse = true;
            }
            else if (inUseFlag != Record.NOT_IN_USE.byteValue())
            {
                throw new IOException("Illegal in use flag: " + inUseFlag);
            }
            NodeRecord record;
            ICollection <DynamicRecord> dynamicLabelRecords = new List <DynamicRecord>();
            long labelField = Record.NO_LABELS_FIELD.intValue();

            if (inUse)
            {
                bool dense = channel.Get() == 1;
                record = new NodeRecord(id, dense, channel.Long, channel.Long);
                // labels
                labelField = channel.Long;
            }
            else
            {
                record = new NodeRecord(id);
            }
            ReadDynamicRecords(channel, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER);
            record.SetLabelField(labelField, dynamicLabelRecords);
            record.InUse = inUse;
            return(record);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected Command read(byte commandType, org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        protected internal override Command Read(sbyte commandType, ReadableChannel channel)
        {
            switch (commandType)
            {
            case NeoCommandType_Fields.NodeCommand:
                return(VisitNodeCommand(channel));

            case NeoCommandType_Fields.PropCommand:
                return(VisitPropertyCommand(channel));

            case NeoCommandType_Fields.PropIndexCommand:
                return(VisitPropertyKeyTokenCommand(channel));

            case NeoCommandType_Fields.RelCommand:
                return(VisitRelationshipCommand(channel));

            case NeoCommandType_Fields.RelTypeCommand:
                return(VisitRelationshipTypeTokenCommand(channel));

            case NeoCommandType_Fields.LabelKeyCommand:
                return(VisitLabelTokenCommand(channel));

            case NeoCommandType_Fields.NeostoreCommand:
                return(VisitNeoStoreCommand(channel));

            case NeoCommandType_Fields.SchemaRuleCommand:
                return(VisitSchemaRuleCommand(channel));

            case NeoCommandType_Fields.RelGroupCommand:
                return(VisitRelationshipGroupCommand(channel));

            case NeoCommandType_Fields.IndexDefineCommand:
                return(VisitIndexDefineCommand(channel));

            case NeoCommandType_Fields.IndexAddCommand:
                return(VisitIndexAddNodeCommand(channel));

            case NeoCommandType_Fields.IndexAddRelationshipCommand:
                return(VisitIndexAddRelationshipCommand(channel));

            case NeoCommandType_Fields.IndexRemoveCommand:
                return(VisitIndexRemoveCommand(channel));

            case NeoCommandType_Fields.IndexDeleteCommand:
                return(VisitIndexDeleteCommand(channel));

            case NeoCommandType_Fields.IndexCreateCommand:
                return(VisitIndexCreateCommand(channel));

            case NeoCommandType_Fields.UpdateRelationshipCountsCommand:
                return(VisitRelationshipCountsCommand(channel));

            case NeoCommandType_Fields.UpdateNodeCountsCommand:
                return(VisitNodeCountsCommand(channel));

            default:
                throw UnknownCommandType(commandType, channel);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitRelationshipGroupCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitRelationshipGroupCommand(ReadableChannel channel)
        {
            long id = channel.Long;
            RelationshipGroupRecord before = ReadRelationshipGroupRecord(id, channel);
            RelationshipGroupRecord after  = ReadRelationshipGroupRecord(id, channel);

            return(new Command.RelationshipGroupCommand(before, after));
        }
Beispiel #18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public RaftMembershipState unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
            public override RaftMembershipState Unmarshal0(ReadableChannel channel)
            {
                long            ordinal   = channel.Long;
                MembershipEntry committed = EntryMarshal.unmarshal(channel);
                MembershipEntry appended  = EntryMarshal.unmarshal(channel);

                return(new RaftMembershipState(ordinal, committed, appended));
            }
Beispiel #19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected GetIndexFilesRequest unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
            protected internal override GetIndexFilesRequest Unmarshal0(ReadableChannel channel)
            {
                StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(channel);
                long    requiredTransactionId = channel.Long;
                long    indexId = channel.Long;

                return(new GetIndexFilesRequest(storeId, indexId, requiredTransactionId));
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitNeoStoreCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitNeoStoreCommand(ReadableChannel channel)
        {
            long           nextProp = channel.Long;
            NeoStoreRecord record   = new NeoStoreRecord();

            record.NextProp = nextProp;
            return(new Command.NeoStoreCommand(null, record));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.record.NeoStoreRecord readNeoStoreRecord(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private NeoStoreRecord ReadNeoStoreRecord(ReadableChannel channel)
        {
            long           nextProp = channel.Long;
            NeoStoreRecord record   = new NeoStoreRecord();

            record.NextProp = nextProp;
            return(record);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitIndexDeleteCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitIndexDeleteCommand(ReadableChannel channel)
        {
            IndexCommandHeader header = ReadIndexCommandHeader(channel);

            IndexCommand.DeleteCommand command = new IndexCommand.DeleteCommand();
            command.Init(header.IndexNameId, header.EntityType);
            return(command);
        }
Beispiel #23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static byte[] readBytes(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
            internal static sbyte[] ReadBytes(ReadableChannel channel)
            {
                int bytesLength = channel.Int;

                sbyte[] bytes = new sbyte[bytesLength];
                channel.Get(bytes, bytesLength);
                return(bytes);
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitRelationshipCountsCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitRelationshipCountsCommand(ReadableChannel channel)
        {
            int  startLabelId = channel.Int;
            int  typeId       = channel.Int;
            int  endLabelId   = channel.Int;
            long delta        = channel.Long;

            return(new Command.RelationshipCountsCommand(startLabelId, typeId, endLabelId, delta));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitIndexCreateCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitIndexCreateCommand(ReadableChannel channel)
        {
            IndexCommandHeader           header = ReadIndexCommandHeader(channel);
            IDictionary <string, string> config = read2bMap(channel);

            IndexCommand.CreateCommand command = new IndexCommand.CreateCommand();
            command.Init(header.IndexNameId, header.EntityType, config);
            return(command);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private long[] readLongs(org.neo4j.storageengine.api.ReadableChannel channel, int count) throws java.io.IOException
        private long[] ReadLongs(ReadableChannel channel, int count)
        {
            long[] result = new long[count];
            for (int i = 0; i < count; i++)
            {
                result[i] = channel.Long;
            }
            return(result);
        }
Beispiel #27
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static String read3bLengthAndString(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        public static string Read3bLengthAndString(ReadableChannel channel)
        {
            short lengthShort = channel.Short;
            sbyte lengthByte  = channel.Get();
            int   length      = (lengthByte << 16) | (lengthShort & 0xFFFF);

            sbyte[] chars = new sbyte[length];
            channel.Get(chars, length);
            return(UTF8.decode(chars));
        }
Beispiel #28
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected GetStoreFileRequest unmarshal0(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
            protected internal override GetStoreFileRequest Unmarshal0(ReadableChannel channel)
            {
                StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(channel);
                long    requiredTransactionId = channel.Long;
                int     fileNameLength        = channel.Int;

                sbyte[] fileNameBytes = new sbyte[fileNameLength];
                channel.Get(fileNameBytes, fileNameLength);
                return(new GetStoreFileRequest(storeId, new File(UTF8.decode(fileNameBytes)), requiredTransactionId));
            }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitIndexDefineCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitIndexDefineCommand(ReadableChannel channel)
        {
            ReadIndexCommandHeader(channel);
            MutableObjectIntMap <string> indexNames = ReadMap(channel);
            MutableObjectIntMap <string> keys       = ReadMap(channel);
            IndexDefineCommand           command    = new IndexDefineCommand();

            command.Init(indexNames, keys);
            return(command);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Command visitIndexRemoveCommand(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException
        private Command VisitIndexRemoveCommand(ReadableChannel channel)
        {
            IndexCommandHeader header   = ReadIndexCommandHeader(channel);
            Number             entityId = header.EntityIdNeedsLong ? channel.Long : channel.Int;
            object             value    = ReadIndexValue(header.ValueType, channel);

            IndexCommand.RemoveCommand command = new IndexCommand.RemoveCommand();
            command.Init(header.IndexNameId, header.EntityType, entityId.longValue(), header.KeyId, value);
            return(command);
        }