Class JournalChannel

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    class JournalChannel
    extends java.lang.Object
    implements java.io.Closeable
    Simple wrapper around FileChannel to add versioning information to the file.
    • Constructor Detail

      • JournalChannel

        JournalChannel​(java.io.File journalDirectory,
                       long logId)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • JournalChannel

        JournalChannel​(java.io.File journalDirectory,
                       long logId,
                       long preAllocSize,
                       int writeBufferSize,
                       ServerConfiguration conf,
                       FileChannelProvider provider)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • JournalChannel

        JournalChannel​(java.io.File journalDirectory,
                       long logId,
                       long preAllocSize,
                       int writeBufferSize,
                       long position,
                       ServerConfiguration conf,
                       FileChannelProvider provider)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • JournalChannel

        JournalChannel​(java.io.File journalDirectory,
                       long logId,
                       long preAllocSize,
                       int writeBufferSize,
                       int journalAlignSize,
                       boolean fRemoveFromPageCache,
                       int formatVersionToWrite,
                       ServerConfiguration conf,
                       FileChannelProvider provider)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • JournalChannel

        JournalChannel​(java.io.File journalDirectory,
                       long logId,
                       long preAllocSize,
                       int writeBufferSize,
                       int journalAlignSize,
                       boolean fRemoveFromPageCache,
                       int formatVersionToWrite,
                       Journal.BufferedChannelBuilder bcBuilder,
                       ServerConfiguration conf,
                       FileChannelProvider provider,
                       java.lang.Long toReplaceLogId)
                throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • renameJournalFile

        public static void renameJournalFile​(java.io.File source,
                                             java.io.File target)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • getFormatVersion

        int getFormatVersion()
      • getBufferedChannel

        BufferedChannel getBufferedChannel()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • preAllocIfNeeded

        void preAllocIfNeeded​(long size)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        int read​(java.nio.ByteBuffer dst)
          throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • forceWrite

        public void forceWrite​(boolean forceMetadata)
                        throws java.io.IOException
        Throws:
        java.io.IOException