Class DefragmentConfig


  • public class DefragmentConfig
    extends java.lang.Object
    Configuration for a defragmentation run.
    See Also:
    Defragment
    • Constructor Detail

      • DefragmentConfig

        public DefragmentConfig​(java.lang.String origPath)
        Creates a configuration for a defragmentation run. The backup and mapping file paths are generated from the original path by appending the default suffixes. All properties other than the provided paths are set to FALSE by default.
        Parameters:
        origPath - The path to the file to be defragmented. Must exist and must be a valid db4o file.
      • DefragmentConfig

        public DefragmentConfig​(java.lang.String origPath,
                                java.lang.String backupPath)
        Creates a configuration for a defragmentation run with in-memory mapping. All properties other than the provided paths are set to FALSE by default.
        Parameters:
        origPath - The path to the file to be defragmented. Must exist and must be a valid db4o file.
        backupPath - The path to the backup of the original file. No file should exist at this position, otherwise it will be OVERWRITTEN if forceBackupDelete() is set to true!
      • DefragmentConfig

        public DefragmentConfig​(java.lang.String origPath,
                                java.lang.String backupPath,
                                IdMapping mapping)
        Creates a configuration for a defragmentation run. All properties other than the provided paths are set to FALSE by default.
        Parameters:
        origPath - The path to the file to be defragmented. Must exist and must be a valid db4o file.
        backupPath - The path to the backup of the original file. No file should exist at this position, otherwise it will be OVERWRITTEN if forceBackupDelete() is set to true!
        mapping - The Id mapping to be used internally. Pass either a InMemoryIdMapping for fastest defragment or a DatabaseIdMapping for low memory consumption.
    • Method Detail

      • origPath

        public java.lang.String origPath()
        Returns:
        The path to the file to be defragmented.
      • backupPath

        public java.lang.String backupPath()
        Returns:
        The path to the backup of the original file.
      • mapping

        public IdMapping mapping()
        Returns:
        The temporary ID mapping used internally. For internal use only.
      • storedClassFilter

        public StoredClassFilter storedClassFilter()
        Returns:
        The StoredClassFilter used to select stored class extents to be included into the defragmented file.
      • storedClassFilter

        public void storedClassFilter​(StoredClassFilter storedClassFilter)
        Parameters:
        storedClassFilter - The StoredClassFilter used to select stored class extents to be included into the defragmented file.
      • forceBackupDelete

        public boolean forceBackupDelete()
        Returns:
        true, if an existing backup file should be deleted, false otherwise.
      • forceBackupDelete

        public void forceBackupDelete​(boolean forceBackupDelete)
        Parameters:
        forceBackupDelete - true, if an existing backup file should be deleted, false otherwise.
      • readOnly

        public void readOnly​(boolean flag)
        allows turning on and off readonly mode.

        When changed classes are likely to be detected defragment, it may be required to open the original database in read/write mode.

        Readonly mode is the default setting.
        Parameters:
        flag - false, to turn off readonly mode.
      • readOnly

        public boolean readOnly()
        Returns:
        true, if the original database file is to be opened in readonly mode.
      • objectCommitFrequency

        public int objectCommitFrequency()
      • objectCommitFrequency

        public void objectCommitFrequency​(int objectCommitFrequency)
        Parameters:
        objectCommitFrequency - The number of processed object (slots) that should trigger an intermediate commit of the target file. Default: 0, meaning: never.
      • upgradeFile

        public void upgradeFile​(java.lang.String tempPath)
        Instruct the defragment process to upgrade the source file to the current db4o version prior to defragmenting it. Use this option if your source file has been created with an older db4o version than the one you are using.
        Parameters:
        tempPath - The location for an intermediate, upgraded version of the source file.
      • fileNeedsUpgrade

        public boolean fileNeedsUpgrade()
      • tempPath

        public java.lang.String tempPath()
      • blockSize

        public int blockSize()
      • vanillaDb4oConfig

        public static Configuration vanillaDb4oConfig​(int blockSize)
      • backupStorage

        public void backupStorage​(Storage backupStorage)
      • backupStorage

        public Storage backupStorage()