Class SingleFileStore


  • public class SingleFileStore
    extends RandomAccessStore
    The default storage mechanism of the MVStore. This implementation persists data to a file. The file store is responsible to persist data and for free space management.
    • Constructor Detail

      • SingleFileStore

        public SingleFileStore​(java.util.Map<java.lang.String,​java.lang.Object> config)
    • Method Detail

      • toString

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

        public java.nio.ByteBuffer readFully​(SFChunk chunk,
                                             long pos,
                                             int len)
        Description copied from class: FileStore
        Read data from the store.
        Specified by:
        readFully in class FileStore<SFChunk>
        Parameters:
        chunk - that owns data to be read
        pos - the read "position"
        len - the number of bytes to read
        Returns:
        the byte buffer with data requested
      • writeFully

        protected void writeFully​(SFChunk chunk,
                                  long pos,
                                  java.nio.ByteBuffer src)
        Description copied from class: FileStore
        Write to the file.
        Specified by:
        writeFully in class FileStore<SFChunk>
        Parameters:
        chunk - to write
        pos - the write position
        src - the source buffer
      • open

        public void open​(java.lang.String fileName,
                         boolean readOnly,
                         char[] encryptionKey)
        Try to open the file.
        Specified by:
        open in class FileStore<SFChunk>
        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
      • truncate

        public void truncate​(long size)
        Truncate the file.
        Specified by:
        truncate in class RandomAccessStore
        Parameters:
        size - the new file size
      • backup

        public void backup​(java.util.zip.ZipOutputStream out)
                    throws java.io.IOException
        Specified by:
        backup in class FileStore<SFChunk>
        Throws:
        java.io.IOException
      • correctFileName

        public static java.lang.String correctFileName​(java.lang.String f)
        Fix the file name, replacing backslash with slash.
        Parameters:
        f - the file name
        Returns:
        the corrected file name