db4o 6.1

com.db4o.defragment
Class BTreeIDMapping

java.lang.Object
  extended by com.db4o.defragment.AbstractContextIDMapping
      extended by com.db4o.defragment.BTreeIDMapping
All Implemented Interfaces:
ContextIDMapping

public class BTreeIDMapping
extends AbstractContextIDMapping

BTree mapping for IDs during a defragmentation run.

See Also:
Defragment

Constructor Summary
BTreeIDMapping(java.lang.String fileName)
          Will maintain the ID mapping as a BTree in the file with the given path.
BTreeIDMapping(java.lang.String fileName, int nodeSize, int cacheHeight, int commitFrequency)
          Will maintain the ID mapping as a BTree in the file with the given path.
 
Method Summary
 void close()
          Shuts down the mapping after use.
 int mappedID(int oldID, boolean lenient)
          Returns a previously registered mapping ID for the given ID if it exists.
 void open()
          Prepares the mapping for use.
 
Methods inherited from class com.db4o.defragment.AbstractContextIDMapping
mapIDs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTreeIDMapping

public BTreeIDMapping(java.lang.String fileName)
Will maintain the ID mapping as a BTree in the file with the given path. If a file exists in this location, it will be DELETED. Node size and cache height of the tree will be the default values used by the BTree implementation. The tree will never commit.

Parameters:
fileName - The location where the BTree file should be created.

BTreeIDMapping

public BTreeIDMapping(java.lang.String fileName,
                      int nodeSize,
                      int cacheHeight,
                      int commitFrequency)
Will maintain the ID mapping as a BTree in the file with the given path. If a file exists in this location, it will be DELETED.

Parameters:
fileName - The location where the BTree file should be created.
nodeSize - The size of a BTree node
cacheHeight - The height of the BTree node cache
commitFrequency - The number of inserts after which a commit should be issued (<=0: never commit)
Method Detail

mappedID

public int mappedID(int oldID,
                    boolean lenient)
Description copied from interface: ContextIDMapping
Returns a previously registered mapping ID for the given ID if it exists. If lenient mode is set to true, will provide the mapping ID for the next smaller original ID a mapping exists for. Otherwise returns 0.

Parameters:
oldID - The original ID
lenient - If true, lenient mode will be used for lookup, strict mode otherwise.
Returns:
The mapping ID for the given original ID or 0, if none has been registered.

open

public void open()
Description copied from interface: ContextIDMapping
Prepares the mapping for use.


close

public void close()
Description copied from interface: ContextIDMapping
Shuts down the mapping after use.


db4o 6.1