Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writeBlock(org.neo4j.io.fs.StoreChannel targetChannel, BlockEntryCursor<KEY,VALUE> blockEntryCursor, long blockSize, long entryCount, Cancellation cancellation, System.Action<int> entryCountReporter, ByteBuffer byteBuffer) throws java.io.IOException
        private void WriteBlock(StoreChannel targetChannel, BlockEntryCursor <KEY, VALUE> blockEntryCursor, long blockSize, long entryCount, Cancellation cancellation, System.Action <int> entryCountReporter, ByteBuffer byteBuffer)
        {
            WriteHeader(byteBuffer, blockSize, entryCount);
            long actualDataSize = WriteEntries(targetChannel, byteBuffer, _layout, blockEntryCursor, cancellation, entryCountReporter);

            WriteLastEntriesWithPadding(targetChannel, byteBuffer, blockSize - actualDataSize);
        }
Esempio n. 2
0
 internal virtual void AddSource(BlockEntryCursor <KEY, VALUE> source)
 {
     _sources.Add(new Source(this, source));
 }
Esempio n. 3
0
 internal Source(MergingBlockEntryReader <KEY, VALUE> outerInstance, BlockEntryCursor <KEY, VALUE> cursor)
 {
     this._outerInstance = outerInstance;
     this.Cursor         = cursor;
 }
Esempio n. 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static <KEY, VALUE> long writeEntries(org.neo4j.io.fs.StoreChannel targetChannel, ByteBuffer byteBuffer, org.neo4j.index.internal.gbptree.Layout<KEY,VALUE> layout, BlockEntryCursor<KEY,VALUE> blockEntryCursor, Cancellation cancellation, System.Action<int> entryCountReporter) throws java.io.IOException
        private static long WriteEntries <KEY, VALUE>(StoreChannel targetChannel, ByteBuffer byteBuffer, Layout <KEY, VALUE> layout, BlockEntryCursor <KEY, VALUE> blockEntryCursor, Cancellation cancellation, System.Action <int> entryCountReporter)
        {
            // Loop over block entries
            long actualDataSize            = BlockHeaderSize;
            ByteArrayPageCursor pageCursor = new ByteArrayPageCursor(byteBuffer);
            int entryCountToReport         = 0;

            while (blockEntryCursor.Next())
            {
                KEY   key       = blockEntryCursor.Key();
                VALUE value     = blockEntryCursor.Value();
                int   entrySize = BlockEntry.EntrySize(layout, key, value);
                actualDataSize += entrySize;
                entryCountToReport++;

                if (byteBuffer.remaining() < entrySize)
                {
                    // First check if this merge have been cancelled, if so just break here, it's fine.
                    if (cancellation.Cancelled())
                    {
                        break;
                    }

                    // flush and reset + DON'T PAD!!!
                    byteBuffer.flip();
                    targetChannel.WriteAll(byteBuffer);
                    byteBuffer.clear();
                    entryCountReporter(entryCountToReport);
                    entryCountToReport = 0;
                }

                BlockEntry.Write(pageCursor, layout, key, value);
            }
            if (entryCountToReport > 0)
            {
                entryCountReporter(entryCountToReport);
            }
            return(actualDataSize);
        }