[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Assembly: Db4objects.Db4o (in Db4objects.Db4o.dll)
defragments database files.
Namespace: Db4objects.Db4o.Defragment
Assembly: Db4objects.Db4o (in Db4objects.Db4o.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Class Defragment |
C# |
---|
public class Defragment |
Visual C++ |
---|
public ref class Defragment |
Remarks
defragments database files.
db4o structures storage inside database files as free and occupied slots, very much like a file system - and just like a file system it can be fragmented.
The simplest way to defragment a database file:
This will move the file to "sample.yap.backup", then create a defragmented version of this file in the original position, using a temporary file "sample.yap.mapping". If the backup file already exists, this will throw an exception and no action will be taken.
For more detailed configuration of the defragmentation process, provide a DefragmentConfig instance:
This will move the file to "sample.bap", then create a defragmented version of this file in the original position, using a temporary file "sample.map" for BTree mapping. If the backup file already exists, it will be deleted. The defragmentation process will skip all classes that have instances stored within the yap file, but that are not available on the class path (through the current classloader). Custom db4o configuration options are read from the Configuration passed as db4oConfig. Note: For some specific, non-default configuration settings like UUID generation, etc., you must pass an appropriate db4o configuration, just like you'd use it within your application for normal database operation.
db4o structures storage inside database files as free and occupied slots, very much like a file system - and just like a file system it can be fragmented.
The simplest way to defragment a database file:
![]() | |
---|---|
Defragment.defrag("sample.yap"); |
This will move the file to "sample.yap.backup", then create a defragmented version of this file in the original position, using a temporary file "sample.yap.mapping". If the backup file already exists, this will throw an exception and no action will be taken.
For more detailed configuration of the defragmentation process, provide a DefragmentConfig instance:
![]() | |
---|---|
DefragmentConfig config=new DefragmentConfig("sample.yap","sample.bap",new BTreeIDMapping("sample.map")); |
This will move the file to "sample.bap", then create a defragmented version of this file in the original position, using a temporary file "sample.map" for BTree mapping. If the backup file already exists, it will be deleted. The defragmentation process will skip all classes that have instances stored within the yap file, but that are not available on the class path (through the current classloader). Custom db4o configuration options are read from the Configuration passed as db4oConfig. Note: For some specific, non-default configuration settings like UUID generation, etc., you must pass an appropriate db4o configuration, just like you'd use it within your application for normal database operation.