Berkeley DB
version 4.8.30

com.sleepycat.db
Class CompactConfig

java.lang.Object
  extended by com.sleepycat.db.CompactConfig
All Implemented Interfaces:
Cloneable

public class CompactConfig
extends Object
implements Cloneable

Configuration for Database.compact(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.CompactConfig) operations.


Field Summary
static CompactConfig DEFAULT
          Default configuration used if null is passed to methods that create a cursor.
 
Constructor Summary
CompactConfig()
          Construct a default configuration object for compact operations.
 
Method Summary
 int getFillPercent()
          Return the the desired fill percentage.
 boolean getFreeListOnly()
          Return true if the whether to skip page compaction.
 boolean getFreeSpace()
          Return true if the whether to return pages to the filesystem.
 int getMaxPages()
          Return the the maximum number of pages to free.
 int getTimeout()
          Return the the lock timeout set for implicit transactions, in microseconds.
 void setFillPercent(int fillpercent)
          Set the desired fill percentage.
 void setFreeListOnly(boolean freeListOnly)
          Configure whether to skip page compaction, only returning pages to the filesystem that are already free and at the end of the file.
 void setFreeSpace(boolean freeSpace)
          Return pages to the filesystem if possible.
 void setMaxPages(int maxPages)
          Set the maximum number of pages to free.
 void setTimeout(int timeout)
          Set the lock timeout for implicit transactions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final CompactConfig DEFAULT
Default configuration used if null is passed to methods that create a cursor.

Constructor Detail

CompactConfig

public CompactConfig()
Construct a default configuration object for compact operations.

Method Detail

setFillPercent

public void setFillPercent(int fillpercent)
Set the desired fill percentage. If non-zero, the goal for filling pages, specified as a percentage between 1 and 100. Any page in a Btree or Recno databases not at or above this percentage full will be considered for compaction. The default behavior is to consider every page for compaction, regardless of its page fill percentage.

Parameters:
fillpercent - The desired fill percentage.

getFillPercent

public int getFillPercent()
Return the the desired fill percentage.

This method may be called at any time during the life of the application.

Returns:
The the desired fill percentage.

setFreeListOnly

public void setFreeListOnly(boolean freeListOnly)
Configure whether to skip page compaction, only returning pages to the filesystem that are already free and at the end of the file. This flag must be set if the database is a Hash access method database.

Parameters:
freeListOnly - Whether to skip page compaction

getFreeListOnly

public boolean getFreeListOnly()
Return true if the whether to skip page compaction.

This method may be called at any time during the life of the application.

Returns:
True if the whether to skip page compaction.

setFreeSpace

public void setFreeSpace(boolean freeSpace)
Return pages to the filesystem if possible. If this flag is not specified, pages emptied as a result of compaction will be placed on the free list for re-use, but not returned to the filesystem. Note that only pages at the end of the file may be returned. Given the one pass nature of the algorithm if a page near the end of the file is logically near the begining of the btree it will inhibit returning pages to the file system. A second call to the method with a low fillfactor can be used to return pages in such a situation.

Parameters:
freeSpace - Whether to return pages to the filesystem

getFreeSpace

public boolean getFreeSpace()
Return true if the whether to return pages to the filesystem.

This method may be called at any time during the life of the application.

Returns:
True if the whether to return pages to the filesystem.

setMaxPages

public void setMaxPages(int maxPages)
Set the maximum number of pages to free.

Parameters:
maxPages - If non-zero, the call will return after that number of pages have been freed.

getMaxPages

public int getMaxPages()
Return the the maximum number of pages to free.

This method may be called at any time during the life of the application.

Returns:
The the maximum number of pages to free.

setTimeout

public void setTimeout(int timeout)
Set the lock timeout for implicit transactions. If non-zero, and no transaction parameter was specified to Database.compact(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.CompactConfig), the lock timeout set for implicit transactions, in microseconds.

Parameters:
timeout - the lock timeout set for implicit transactions, in microseconds.

getTimeout

public int getTimeout()
Return the the lock timeout set for implicit transactions, in microseconds.

This method may be called at any time during the life of the application.

Returns:
The the lock timeout set for implicit transactions, in microseconds.

Berkeley DB
version 4.8.30

Copyright (c) 1996-2009 Oracle. All rights reserved.