Package org.apache.cassandra.io.util
Interface DiskOptimizationStrategy
-
- All Known Implementing Classes:
SpinningDiskOptimizationStrategy
,SsdDiskOptimizationStrategy
public interface DiskOptimizationStrategy
-
-
Field Summary
Fields Modifier and Type Field 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 Description int
bufferSize(long recordSize)
default int
roundBufferSize(long size)
Round up to the next multiple of 4k but no more thanMAX_BUFFER_SIZE
.static int
roundForCaching(int size, boolean roundUp)
Round either up or down to the next power of two, which is required by theChunkCache.CachingRebufferer
, but capping betweenMIN_BUFFER_SIZE
andMAX_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 thanMAX_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 theChunkCache.CachingRebufferer
, but capping betweenMIN_BUFFER_SIZE
andMAX_BUFFER_SIZE
.- Parameters:
size
- - the size to round to a power of two, normally this is a buffer size that was previously returned by abufferSize(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 thanMIN_BUFFER_SIZE
.
-
-