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

Package org.apache.geode.cache

# Interface DiskStore

public interface DiskStore
Provides disk storage for one or more regions. The regions in the same disk store will share the same disk persistence attributes. A region without a disk store name belongs to the default disk store.

Instances of this interface are created using `DiskStoreFactory.create(java.lang.String)`. So to create a `DiskStore` named `myDiskStore` do this:

     new DiskStoreFactory().create("myDiskStore");

Existing DiskStore instances can be found using `GemFireCache.findDiskStore(String)`

Since:
  GemFire 6.5

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `destroy()`
  Destroys this disk store.
  `void`
  `flush()`
  Causes any data that is currently in the asynchronous queue to be written to disk.
  `boolean`
  `forceCompaction()`
  Allows a disk compaction to be forced on this disk store.
  `void`
  `forceRoll()`
  Asks the disk store to start writing to a new oplog.
  `boolean`
  `getAllowForceCompaction()`
  Returns true if manual compaction of disk files is allowed on this region.
  `boolean`
  `getAutoCompact()`
  Returns true if the disk files are to be automatically compacted.
  `int`
  `getCompactionThreshold()`
  Returns the threshold at which an oplog will become compactable.
  `File[]`
  `getDiskDirs()`
  Returns the directories to which the region's data are written.
  `int[]`
  `getDiskDirSizes()`
  Returns the sizes of the disk directories in megabytes
  `UUID`
  `getDiskStoreUUID()`
  Returns the universally unique identifier for the Disk Store across the GemFire distributed system.
  `float`
  `getDiskUsageCriticalPercentage()`
  Returns the critical threshold for disk usage as a percentage of the total disk volume.
  `float`
  `getDiskUsageWarningPercentage()`
  Returns the warning threshold for disk usage as a percentage of the total disk volume.
  `long`
  `getMaxOplogSize()`
  Get the maximum size in megabytes a single oplog (operation log) file should be
  `String`
  `getName()`
  Get the name of the DiskStore
  `int`
  `getQueueSize()`
  Returns the maximum number of operations that can be asynchronously queued to be written to disk.
  `long`
  `getTimeInterval()`
  Returns the number of milliseconds that can elapse before unwritten data is written to disk.
  `int`
  `getWriteBufferSize()`
  Returns the size of the write buffer that this disk store will use when writing data to disk.
  `void`
  `setDiskUsageCriticalPercentage(float criticalPercent)`
  Sets the value of the disk usage critical percentage.
  `void`
  `setDiskUsageWarningPercentage(float warningPercent)`
  Sets the value of the disk usage warning percentage.

- ## Method Details

  - ### getName

    String getName()
    Get the name of the DiskStore
    Returns:
      the name of the DiskStore
    See Also:
      - `DiskStoreFactory.create(java.lang.String)`

  - ### getAutoCompact

    boolean getAutoCompact()
    Returns true if the disk files are to be automatically compacted.
    Returns:
      Returns true if the disk files are to be automatically compacted; false if automatic compaction is turned off

  - ### getCompactionThreshold

    int getCompactionThreshold()
    Returns 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.
    Returns:
      the threshold, as a percentage, at which an oplog is considered compactable.

  - ### getAllowForceCompaction

    boolean getAllowForceCompaction()
    Returns true if manual compaction of disk files is allowed on this region. Manual compaction is done be calling `forceCompaction()`.

    Note that calls to `forceCompaction()` will also be allowed if `automatic compaction` is enabled.

    Returns:
      Returns true if manual compaction of disk files is allowed on this region.

  - ### getMaxOplogSize

    long getMaxOplogSize()
    Get the maximum size in megabytes a single oplog (operation log) file should be
    Returns:
      the maximum size in megabyte the operations log file can be

  - ### getTimeInterval

    long getTimeInterval()
    Returns the number of milliseconds that can elapse before unwritten data is written to disk.
    Returns:
      Returns the time interval in milliseconds that can elapse between two writes to disk

  - ### getWriteBufferSize

    int getWriteBufferSize()
    Returns the size of the write buffer that this disk store will use when writing data to disk. Larger values may increase performance but will use more memory. The disk store will allocate one direct memory buffer of this size.
    Returns:
      Returns the size of the write buffer.

  - ### getDiskDirs

    File[] getDiskDirs()
    Returns the directories to which the region's data are written. If multiple directories are used, GemFire will attempt to distribute the data evenly amongst them.
    Returns:
      the directories to which the region's data are written

  - ### getDiskDirSizes

    int[] getDiskDirSizes()
    Returns the sizes of the disk directories in megabytes
    Returns:
      the sizes of the disk directories in megabytes

  - ### getDiskStoreUUID

    UUID getDiskStoreUUID()
    Returns the universally unique identifier for the Disk Store across the GemFire distributed system.

    Returns:
      a UUID uniquely identifying this Disk Store in the GemFire distributed system.
    See Also:
      - `UUID`

  - ### getQueueSize

    int getQueueSize()
    Returns the maximum number of operations that can be asynchronously queued to be written to disk. When this limit is reached, it will cause operations to block until they can be put in the queue. If this `DiskStore` configures synchronous writing, then `queueSize` is ignored.
    Returns:
      the maxinum number of entries that can be queued concurrently for asynchronous writting to disk.

  - ### flush

    void flush()
    Causes any data that is currently in the asynchronous queue to be written to disk. Does not return until the flush is complete.
    Throws:
      `DiskAccessException` - If problems are encounter while writing to disk

  - ### forceRoll

    void forceRoll()
    Asks the disk store to start writing to a new oplog. The old oplog will be asynchronously compressed if compaction is set to true. The new oplog will be created in the next available directory with free space. If there is no directory with free space available and compaction is set to false, then a `DiskAccessException` saying that the disk is full will be thrown. If compaction is true then the application will wait for the other oplogs to be compacted and more space to be created.

  - ### forceCompaction

    boolean forceCompaction()
    Allows a disk compaction to be forced on this disk store. The compaction is done even if automatic compaction is not configured. If the current active oplog has had data written to it and it is compactable then an implicit call to `forceRoll()` will be made so that the active oplog can be compacted.

    This method will block until the compaction completes.

    Returns:
      `true` if one or more oplogs were compacted; `false` indicates that no oplogs were ready to be compacted or that a compaction was already in progress.
    See Also:
      - `getAllowForceCompaction()`

  - ### destroy

    void destroy()
    Destroys this disk store. Removes the disk store from the cache, and removes all files related to the disk store from disk. If there are any currently open regions in the disk store this method will throw an exception. If there are any closed regions that are persisted in this disk store, the data for those regions will be destroyed.
    Throws:
      `IllegalStateException` - if the disk store is currently in use by any regions, gateway senders, or a PDX type registry.
    Since:
      GemFire 8.0

  - ### getDiskUsageWarningPercentage

    float getDiskUsageWarningPercentage()
    Returns the warning threshold for disk usage as a percentage of the total disk volume.
    Returns:
      the warning percent
    Since:
      GemFire 8.0

  - ### getDiskUsageCriticalPercentage

    float getDiskUsageCriticalPercentage()
    Returns the critical threshold for disk usage as a percentage of the total disk volume.
    Returns:
      the critical percent
    Since:
      GemFire 8.0

  - ### setDiskUsageWarningPercentage

    void setDiskUsageWarningPercentage(float warningPercent)
    Sets the value of the disk usage warning percentage.
    Parameters:
      `warningPercent` - the warning percent

  - ### setDiskUsageCriticalPercentage

    void setDiskUsageCriticalPercentage(float criticalPercent)
    Sets the value of the disk usage critical percentage.
    Parameters:
      `criticalPercent` - the critical percent