Package com.db4o.defragment
Class DefragmentConfig
- java.lang.Object
-
- com.db4o.defragment.DefragmentConfig
-
public class DefragmentConfig extends java.lang.ObjectConfiguration for a defragmentation run.- See Also:
Defragment
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDefragmentConfig.NullFilter
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBACKUP_SUFFIXstatic booleanDEBUG
-
Constructor Summary
Constructors Constructor Description DefragmentConfig(java.lang.String origPath)Creates a configuration for a defragmentation run.DefragmentConfig(java.lang.String origPath, java.lang.String backupPath)Creates a configuration for a defragmentation run with in-memory mapping.DefragmentConfig(java.lang.String origPath, java.lang.String backupPath, IdMapping mapping)Creates a configuration for a defragmentation run.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringbackupPath()StoragebackupStorage()voidbackupStorage(Storage backupStorage)intblockSize()ConfigurationclonedDb4oConfig()Configurationdb4oConfig()voiddb4oConfig(Configuration config)Deprecated.since 7.9: usedb4oConfig(EmbeddedConfiguration)insteadvoiddb4oConfig(EmbeddedConfiguration config)booleanfileNeedsUpgrade()booleanforceBackupDelete()voidforceBackupDelete(boolean forceBackupDelete)IdMappingmapping()intobjectCommitFrequency()voidobjectCommitFrequency(int objectCommitFrequency)java.lang.StringorigPath()booleanreadOnly()voidreadOnly(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.StoredClassFilterstoredClassFilter()voidstoredClassFilter(StoredClassFilter storedClassFilter)java.lang.StringtempPath()voidupgradeFile(java.lang.String tempPath)Instruct the defragment process to upgrade the source file to the current db4o version prior to defragmenting it.static ConfigurationvanillaDb4oConfig(int blockSize)
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
- See Also:
- Constant Field Values
-
BACKUP_SUFFIX
public static final java.lang.String BACKUP_SUFFIX
- See Also:
- Constant Field Values
-
-
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 aInMemoryIdMappingfor fastest defragment or aDatabaseIdMappingfor 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
StoredClassFilterused to select stored class extents to be included into the defragmented file.
-
storedClassFilter
public void storedClassFilter(StoredClassFilter storedClassFilter)
- Parameters:
storedClassFilter- TheStoredClassFilterused 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.
-
db4oConfig
public Configuration db4oConfig()
- Returns:
- The db4o
Configurationto be applied during the defragment process.
-
db4oConfig
public void db4oConfig(Configuration config)
Deprecated.since 7.9: usedb4oConfig(EmbeddedConfiguration)instead- Parameters:
config- The db4oConfigurationto be applied during the defragment process.
-
db4oConfig
public void db4oConfig(EmbeddedConfiguration config)
- Parameters:
config- The db4oEmbeddedConfigurationto be applied during the defragment process.- Since:
- 7.9
-
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)
-
clonedDb4oConfig
public Configuration clonedDb4oConfig()
-
backupStorage
public void backupStorage(Storage backupStorage)
-
backupStorage
public Storage backupStorage()
-
-