DiskStoreFactory (Apache Geode 2.0.2)
Description: declaration: package: org.apache.geode.cache, interface: DiskStoreFactory

Package org.apache.geode.cache

# Interface DiskStoreFactory

public interface DiskStoreFactory
Factory for creating instances of `DiskStore`. To get an instance of this factory call `GemFireCache.createDiskStoreFactory()`. If all you want to do is find an existing disk store see `GemFireCache.findDiskStore(java.lang.String)`.

To use this factory configure it with the `set` methods and then call `create(java.lang.String)` to produce a disk store instance.

Since:
  GemFire 6.5

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final boolean`
  `DEFAULT_ALLOW_FORCE_COMPACTION`
  The default value of the allow force compaction attribute.
  `static final boolean`
  `DEFAULT_AUTO_COMPACT`
  The default setting for auto compaction.
  `static final int`
  `DEFAULT_COMPACTION_THRESHOLD`
  The default compaction threshold.
  `static final int`
  `DEFAULT_DISK_DIR_SIZE`
  The default disk directory size in megabytes.
  `static final int[]`
  `DEFAULT_DISK_DIR_SIZES`
  The default disk directory sizes.
  `static final File[]`
  `DEFAULT_DISK_DIRS`
  The default disk directories.
  `static final String`
  `DEFAULT_DISK_STORE_NAME`
  The name of the default disk store is "DEFAULT".
  `static final float`
  `DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGE`
  The default disk usage critical percentage.
  `static final float`
  `DEFAULT_DISK_USAGE_WARNING_PERCENTAGE`
  The default disk usage warning percentage.
  `static final long`
  `DEFAULT_MAX_OPLOG_SIZE`
  The default maximum oplog file size in megabytes.
  `static final int`
  `DEFAULT_QUEUE_SIZE`
  The default maximum number of operations that can be asynchronously queued.
  `static final long`
  `DEFAULT_TIME_INTERVAL`
  The default time interval in milliseconds.
  `static final int`
  `DEFAULT_WRITE_BUFFER_SIZE`
  The default write buffer size.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DiskStore`
  `create(String name)`
  Create a new disk store or find an existing one.
  `DiskStoreFactory`
  `setAllowForceCompaction(boolean allowForceCompaction)`
  Set to `true` to allow `DiskStore.forceCompaction()` to be called on regions using this disk store.
  `DiskStoreFactory`
  `setAutoCompact(boolean isAutoCompact)`
  Set to `true` to cause the disk files to be automatically compacted.
  `DiskStoreFactory`
  `setCompactionThreshold(int compactionThreshold)`
  Sets the threshold at which an oplog will become compactable.
  `DiskStoreFactory`
  `setDiskDirs(File[] diskDirs)`
  Sets the directories to which this disk store's data is written.
  `DiskStoreFactory`
  `setDiskDirsAndSizes(File[] diskDirs, int[] diskDirSizes)`
  Sets the directories to which this disk store's data is written and also set the sizes in megabytes of each directory.
  `DiskStoreFactory`
  `setDiskUsageCriticalPercentage(float criticalPercent)`
  Sets the critical threshold for disk usage as a percentage of the total disk volume.
  `DiskStoreFactory`
  `setDiskUsageWarningPercentage(float warningPercent)`
  Sets the warning threshold for disk usage as a percentage of the total disk volume.
  `DiskStoreFactory`
  `setMaxOplogSize(long maxOplogSize)`
  Sets the maximum size in megabytes a single oplog (operation log) is allowed to be.
  `DiskStoreFactory`
  `setQueueSize(int queueSize)`
  Sets the maximum number of operations that can be asynchronously queued.
  `DiskStoreFactory`
  `setTimeInterval(long timeInterval)`
  Sets the number of milliseconds that can elapse before data written asynchronously is flushed to disk.
  `DiskStoreFactory`
  `setWriteBufferSize(int writeBufferSize)`
  Sets the write buffer size in bytes.

- ## Field Details

  - ### DEFAULT_DISK_STORE_NAME

    static final String DEFAULT_DISK_STORE_NAME
    The name of the default disk store is "DEFAULT". This name can be used to redefine the default disk store. Regions that have not had their disk-store-name set will use this disk store.
    See Also:
      - Constant Field Values

  - ### DEFAULT_AUTO_COMPACT

    static final boolean DEFAULT_AUTO_COMPACT
    The default setting for auto compaction.

    Current value: `true`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_COMPACTION_THRESHOLD

    static final int DEFAULT_COMPACTION_THRESHOLD
    The default compaction threshold.

    Current value: `50`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_ALLOW_FORCE_COMPACTION

    static final boolean DEFAULT_ALLOW_FORCE_COMPACTION
    The default value of the allow force compaction attribute.

    Current value: `false`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_MAX_OPLOG_SIZE

    static final long DEFAULT_MAX_OPLOG_SIZE
    The default maximum oplog file size in megabytes.

    Current value: `1024` which is one gigabyte.

  - ### DEFAULT_TIME_INTERVAL

    static final long DEFAULT_TIME_INTERVAL
    The default time interval in milliseconds.

    Current value: `1000`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_WRITE_BUFFER_SIZE

    static final int DEFAULT_WRITE_BUFFER_SIZE
    The default write buffer size.

    Current value: `32768`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_QUEUE_SIZE

    static final int DEFAULT_QUEUE_SIZE
    The default maximum number of operations that can be asynchronously queued.

    Current value: `0`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_DISK_DIRS

    static final File[] DEFAULT_DISK_DIRS
    The default disk directories.

    Current value: `current directory`.

  - ### DEFAULT_DISK_DIR_SIZE

    static final int DEFAULT_DISK_DIR_SIZE
    The default disk directory size in megabytes.

    Current value: `2,147,483,647` which is two petabytes.

    See Also:
      - Constant Field Values

  - ### DEFAULT_DISK_DIR_SIZES

    static final int[] DEFAULT_DISK_DIR_SIZES
    The default disk directory sizes.

    Current value: `DEFAULT_DISK_DIR_SIZE` which is two petabytes each.

  - ### DEFAULT_DISK_USAGE_WARNING_PERCENTAGE

    static final float DEFAULT_DISK_USAGE_WARNING_PERCENTAGE
    The default disk usage warning percentage.

    Current value: `90`.

    See Also:
      - Constant Field Values

  - ### DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGE

    static final float DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGE
    The default disk usage critical percentage.

    Current value: `99`.

    See Also:
      - Constant Field Values

- ## Method Details

  - ### setAutoCompact

    DiskStoreFactory setAutoCompact(boolean isAutoCompact)
    Set to `true` to cause the disk files to be automatically compacted. Set to `false` if no compaction is needed or manual compaction will be used.
    Parameters:
      `isAutoCompact` - if true then use auto compaction
    Returns:
      a reference to `this`

  - ### setCompactionThreshold

    DiskStoreFactory setCompactionThreshold(int compactionThreshold)
    Sets the threshold at which an oplog will become compactable. Until it reaches this threshold the oplog will not be compacted. The threshold is a percentage in the range 0..100. When the amount of live data in an oplog becomes less than this percentage then when a compaction is done this garbage will be cleaned up freeing up disk space. Garbage is created by entry destroys, entry updates, and region destroys.
    Parameters:
      `compactionThreshold` - percentage of remaining live data in the oplog at which an oplog is compactable
    Returns:
      a reference to `this`

  - ### setAllowForceCompaction

    DiskStoreFactory setAllowForceCompaction(boolean allowForceCompaction)
    Set to `true` to allow `DiskStore.forceCompaction()` to be called on regions using this disk store.
    Parameters:
      `allowForceCompaction` - if true then allow force compaction.
    Returns:
      a reference to `this`

  - ### setMaxOplogSize

    DiskStoreFactory setMaxOplogSize(long maxOplogSize)
    Sets the maximum size in megabytes a single oplog (operation log) is allowed to be. When an oplog is created this amount of file space will be immediately reserved.
    Parameters:
      `maxOplogSize` - maximum size in megabytes for one single oplog file.
    Returns:
      a reference to `this`

  - ### setTimeInterval

    DiskStoreFactory setTimeInterval(long timeInterval)
    Sets the number of milliseconds that can elapse before data written asynchronously is flushed to disk.

    For how to configure a region to be asynchronous see: `AttributesFactory.setDiskSynchronous(boolean)`.

    Parameters:
      `timeInterval` - number of milliseconds that can elapse before async data is flushed to disk.
    Returns:
      a reference to `this`

  - ### setWriteBufferSize

    DiskStoreFactory setWriteBufferSize(int writeBufferSize)
    Sets the write buffer size in bytes.
    Parameters:
      `writeBufferSize` - write buffer size in bytes.
    Returns:
      a reference to `this`

  - ### setQueueSize

    DiskStoreFactory setQueueSize(int queueSize)
    Sets the maximum number of operations that can be asynchronously queued. Once this many pending async operations have been queued async ops will begin blocking until some of the queued ops have been flushed to disk.

    For how to configure a region to be asynchronous see: `AttributesFactory.setDiskSynchronous(boolean)`.

    Parameters:
      `queueSize` - number of operations that can be asynchronously queued. If 0, the queue will be unlimited.
    Returns:
      a reference to `this`

  - ### setDiskDirs

    DiskStoreFactory setDiskDirs(File[] diskDirs)
    Sets the directories to which this disk store's data is written. If multiple directories are used, GemFire will attempt to distribute the data evenly amongst them. The size of each directory will be set to the default of `DEFAULT_DISK_DIR_SIZE`.
    Parameters:
      `diskDirs` - directories to put the oplog files.
    Returns:
      a reference to `this`

  - ### setDiskDirsAndSizes

    DiskStoreFactory setDiskDirsAndSizes(File[] diskDirs, int[] diskDirSizes)
    Sets the directories to which this disk store's data is written and also set the sizes in megabytes of each directory.
    Parameters:
      `diskDirs` - directories to put the oplog files.
      `diskDirSizes` - sizes of disk directories in megabytes
    Returns:
      a reference to `this`
    Throws:
      `IllegalArgumentException` - if length of the size array does not match to the length of the dir array

  - ### setDiskUsageWarningPercentage

    DiskStoreFactory setDiskUsageWarningPercentage(float warningPercent)
    Sets the warning threshold for disk usage as a percentage of the total disk volume.
    Parameters:
      `warningPercent` - warning percent of disk usage
    Returns:
      a reference to `this`
    Since:
      GemFire 8.0

  - ### setDiskUsageCriticalPercentage

    DiskStoreFactory setDiskUsageCriticalPercentage(float criticalPercent)
    Sets the critical threshold for disk usage as a percentage of the total disk volume.
    Parameters:
      `criticalPercent` - critical percent of disk usage
    Returns:
      a reference to `this`
    Since:
      GemFire 8.0

  - ### create

    DiskStore create(String name)
    Create a new disk store or find an existing one. In either case the returned disk store's configuration will be the same as this factory's configuration.
    Parameters:
      `name` - the name of the DiskStore
    Returns:
      the newly created DiskStore.
    Throws:
      `IllegalStateException` - if a disk store with the given name already exists and its configuration is not consistent with this factory.