org.apache.cassandra.io.util

## Interface DiskOptimizationStrategy

- All Known Implementing Classes:
    SpinningDiskOptimizationStrategy, SsdDiskOptimizationStrategy

      public interface DiskOptimizationStrategy

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MAX_BUFFER_SIZE`
    `static int` | `MIN_BUFFER_SIZE`
    `static int` | `MIN_BUFFER_SIZE_MASK`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `bufferSize(long recordSize)`
    `default int` | `roundBufferSize(long size)` Round up to the next multiple of 4k but no more than `MAX_BUFFER_SIZE`.
    `static int` | `roundForCaching(int size, boolean roundUp)` Round either up or down to the next power of two, which is required by the `ChunkCache.CachingRebufferer`, but capping between `MIN_BUFFER_SIZE` and `MAX_BUFFER_SIZE`.

- - ### Field Detail

    - #### MIN_BUFFER_SIZE

          static final int MIN_BUFFER_SIZE

      See Also:
        Constant Field Values

    - #### MIN_BUFFER_SIZE_MASK

          static final int MIN_BUFFER_SIZE_MASK

      See Also:
        Constant Field Values

    - #### MAX_BUFFER_SIZE

          static final int MAX_BUFFER_SIZE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### bufferSize

          int bufferSize(long recordSize)

      Parameters:
        `recordSize` - record size
      Returns:
        the buffer size for a given record size.

    - #### roundBufferSize

          default int roundBufferSize(long size)

      Round up to the next multiple of 4k but no more than `MAX_BUFFER_SIZE`.

    - #### roundForCaching

          static int roundForCaching(int size,
                                     boolean roundUp)

      Round either up or down to the next power of two, which is required by the `ChunkCache.CachingRebufferer`, but capping between `MIN_BUFFER_SIZE` and `MAX_BUFFER_SIZE`.
      Parameters:
        `size` - - the size to round to a power of two, normally this is a buffer size that was previously returned by a `bufferSize(long)`.
        `roundUp` - - whether to round up or down
      Returns:
        a value rounded to a power of two but never bigger than `MAX_BUFFER_SIZE` or smaller than `MIN_BUFFER_SIZE`.

Copyright © 2018 The Apache Software Foundation