Class OffHeapStore


  • public class OffHeapStore
    extends FileStore
    A storage mechanism that "persists" data in the off-heap area of the main memory.
    • Field Detail

      • memory

        private final java.util.TreeMap<java.lang.Long,​java.nio.ByteBuffer> memory
    • Constructor Detail

      • OffHeapStore

        public OffHeapStore()
    • Method Detail

      • open

        public void open​(java.lang.String fileName,
                         boolean readOnly,
                         char[] encryptionKey)
        Description copied from class: FileStore
        Try to open the file.
        Overrides:
        open in class FileStore
        Parameters:
        fileName - the file name
        readOnly - whether the file should only be opened in read-only mode, even if the file is writable
        encryptionKey - the encryption key, or null if encryption is not used
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class FileStore
      • readFully

        public java.nio.ByteBuffer readFully​(long pos,
                                             int len)
        Description copied from class: FileStore
        Read from the file.
        Overrides:
        readFully in class FileStore
        Parameters:
        pos - the write position
        len - the number of bytes to read
        Returns:
        the byte buffer
      • free

        public void free​(long pos,
                         int length)
        Description copied from class: FileStore
        Mark the space as free.
        Overrides:
        free in class FileStore
        Parameters:
        pos - the position in bytes
        length - the number of bytes
      • writeFully

        public void writeFully​(long pos,
                               java.nio.ByteBuffer src)
        Description copied from class: FileStore
        Write to the file.
        Overrides:
        writeFully in class FileStore
        Parameters:
        pos - the write position
        src - the source buffer
      • writeNewEntry

        private void writeNewEntry​(long pos,
                                   java.nio.ByteBuffer src)
      • truncate

        public void truncate​(long size)
        Description copied from class: FileStore
        Truncate the file.
        Overrides:
        truncate in class FileStore
        Parameters:
        size - the new file size
      • close

        public void close()
        Description copied from class: FileStore
        Close this store.
        Overrides:
        close in class FileStore
      • sync

        public void sync()
        Description copied from class: FileStore
        Flush all changes.
        Overrides:
        sync in class FileStore
      • getDefaultRetentionTime

        public int getDefaultRetentionTime()
        Description copied from class: FileStore
        Get the default retention time for this store in milliseconds.
        Overrides:
        getDefaultRetentionTime in class FileStore
        Returns:
        the retention time