SCompactConfig (Oracle - Berkeley DB Client-Server API)
Date: 2018-05-29

com.sleepycat.client

## Class SCompactConfig

- java.lang.Object
- - com.sleepycat.client.SCompactConfig

-     public class SCompactConfig
      extends java.lang.Object

  Configuration for `SDatabase.compact(com.sleepycat.client.STransaction, com.sleepycat.client.SDatabaseEntry, com.sleepycat.client.SDatabaseEntry, com.sleepycat.client.SDatabaseEntry, com.sleepycat.client.SCompactConfig)` operations.

  For a user created instance, no attribute is set by default. In addition, calling the getter method of an unset attribute results in an IllegalStateException. To set an attribute, call the setter method of the attribute.

  When used to perform a compaction, system default values are used for unset attributes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SCompactConfig()` Create an empty SCompactConfig with no attribute set.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.Object` | `getField(F field)` Return the value set on a specified field.
    `int` | `getFillPercent()` Return the the desired fill percentage.
    `boolean` | `getFreeListOnly()` Return true if page compaction is skipped.
    `boolean` | `getFreeSpace()` Return true if pages are returned to the filesystem.
    `int` | `getMaxPages()` Return the maximum number of pages to free.
    `protected T` | `getThriftObj()`
    `int` | `getTimeout()` Return the lock timeout set for implicit transactions, in microseconds.
    `SCompactConfig` | `setFillPercent(int fillpercent)` Set the desired fill percentage.
    `SCompactConfig` | `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.
    `SCompactConfig` | `setFreeSpace(boolean freeSpace)` Return pages to the filesystem if possible.
    `SCompactConfig` | `setMaxPages(int maxPages)` Set the maximum number of pages to free.
    `SCompactConfig` | `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`

- - ### Constructor Detail

    - #### SCompactConfig

          public SCompactConfig()

      Create an empty SCompactConfig with no attribute set.

  - ### Method Detail

    - #### getFillPercent

          public int getFillPercent()

      Return the the desired fill percentage.
      Returns:
        the the desired fill percentage

    - #### setFillPercent

          public SCompactConfig 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
      Returns:
        this

    - #### getFreeListOnly

          public boolean getFreeListOnly()

      Return true if page compaction is skipped.
      Returns:
        true if page compaction is skipped

    - #### setFreeListOnly

          public SCompactConfig 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
      Returns:
        this

    - #### getFreeSpace

          public boolean getFreeSpace()

      Return true if pages are returned to the filesystem.
      Returns:
        true if pages are returned to the filesystem

    - #### setFreeSpace

          public SCompactConfig 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
      Returns:
        this

    - #### getMaxPages

          public int getMaxPages()

      Return the maximum number of pages to free.
      Returns:
        the maximum number of pages to free

    - #### setMaxPages

          public SCompactConfig 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
      Returns:
        this

    - #### getTimeout

          public int getTimeout()

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

    - #### setTimeout

          public SCompactConfig setTimeout(int timeout)

      Set the lock timeout for implicit transactions. If non-zero, and no transaction parameter was specified to `SDatabase.compact(com.sleepycat.client.STransaction, com.sleepycat.client.SDatabaseEntry, com.sleepycat.client.SDatabaseEntry, com.sleepycat.client.SDatabaseEntry, com.sleepycat.client.SCompactConfig)`, the lock timeout set for implicit transactions, in microseconds.
      Parameters:
        `timeout` - the lock timeout set for implicit transactions, in microseconds
      Returns:
        this

    - #### getThriftObj

          protected T getThriftObj()

    - #### getField

          protected java.lang.Object getField(F field)
                                       throws java.lang.IllegalStateException

      Return the value set on a specified field. Throw IllegalStateException if the field is not set.
      Parameters:
        `field` - the field
      Returns:
        the field's value
      Throws:
        `java.lang.IllegalStateException` - if the field is not set

Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.