Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createLogFile(org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction fsa, long prevFileLastIndex, long fileNameVersion, long headerVersion, long prevIndex, long prevTerm) throws java.io.IOException
        private void CreateLogFile(EphemeralFileSystemAbstraction fsa, long prevFileLastIndex, long fileNameVersion, long headerVersion, long prevIndex, long prevTerm)
        {
            StoreChannel             channel = fsa.Open(_fileNames.getForVersion(fileNameVersion), OpenMode.READ_WRITE);
            PhysicalFlushableChannel writer  = new PhysicalFlushableChannel(channel);

            _headerMarshal.marshal(new SegmentHeader(prevFileLastIndex, headerVersion, prevIndex, prevTerm), writer);
            writer.PrepareForFlush().flush();
            channel.close();
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void appendDropTransactionToTransactionLog(java.io.File databaseDirectory, org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation dropTransaction) throws java.io.IOException
        private void AppendDropTransactionToTransactionLog(File databaseDirectory, CommittedTransactionRepresentation dropTransaction)
        {
            LogFiles     logFiles          = LogFilesBuilder.logFilesBasedOnlyBuilder(databaseDirectory, Fs).build();
            File         logFile           = logFiles.GetLogFileForVersion(logFiles.HighestLogVersion);
            StoreChannel writeStoreChannel = Fs.open(logFile, OpenMode.READ_WRITE);

            writeStoreChannel.Position(writeStoreChannel.size());
            using (PhysicalFlushableChannel writeChannel = new PhysicalFlushableChannel(writeStoreChannel))
            {
                (new LogEntryWriter(writeChannel)).serialize(dropTransaction);
            }
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void arraysShouldCalculateCorrectLength() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ArraysShouldCalculateCorrectLength()
        {
            // given
            int[] value = new int[3];
            for (int i = 0; i < value.Length; i++)
            {
                value[i] = 100 + i;
            }
            ValueType valueType = ValueType.typeOf(value);
            PhysicalFlushableChannel channel = new PhysicalFlushableChannel(Fs.open(Directory.file("file"), OpenMode.READ_WRITE));

            // when
            int length = valueType.Length(value);

            valueType.Write(value, channel);

            // then
            int expected = 1 + Integer.BYTES + value.Length * Integer.BYTES;               // array data

            assertEquals(expected, length);
            assertEquals(expected, channel.Position());
        }