Package com.db4o.defragment
Class DefragmentConfig
- java.lang.Object
-
- com.db4o.defragment.DefragmentConfig
-
public class DefragmentConfig extends java.lang.Object
Configuration for a defragmentation run.- See Also:
Defragment
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefragmentConfig.NullFilter
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BACKUP_SUFFIX
static boolean
DEBUG
-
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.String
backupPath()
Storage
backupStorage()
void
backupStorage(Storage backupStorage)
int
blockSize()
Configuration
clonedDb4oConfig()
Configuration
db4oConfig()
void
db4oConfig(Configuration config)
Deprecated.since 7.9: usedb4oConfig(EmbeddedConfiguration)
insteadvoid
db4oConfig(EmbeddedConfiguration config)
boolean
fileNeedsUpgrade()
boolean
forceBackupDelete()
void
forceBackupDelete(boolean forceBackupDelete)
IdMapping
mapping()
int
objectCommitFrequency()
void
objectCommitFrequency(int objectCommitFrequency)
java.lang.String
origPath()
boolean
readOnly()
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.StoredClassFilter
storedClassFilter()
void
storedClassFilter(StoredClassFilter storedClassFilter)
java.lang.String
tempPath()
void
upgradeFile(java.lang.String tempPath)
Instruct the defragment process to upgrade the source file to the current db4o version prior to defragmenting it.static Configuration
vanillaDb4oConfig(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 aInMemoryIdMapping
for fastest defragment or aDatabaseIdMapping
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
- TheStoredClassFilter
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.
-
db4oConfig
public Configuration db4oConfig()
- Returns:
- The db4o
Configuration
to be applied during the defragment process.
-
db4oConfig
public void db4oConfig(Configuration config)
Deprecated.since 7.9: usedb4oConfig(EmbeddedConfiguration)
instead- Parameters:
config
- The db4oConfiguration
to be applied during the defragment process.
-
db4oConfig
public void db4oConfig(EmbeddedConfiguration config)
- Parameters:
config
- The db4oEmbeddedConfiguration
to 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()
-
-