Package org.apache.cassandra.io.util
Interface DiskOptimizationStrategy
- All Known Implementing Classes:
SpinningDiskOptimizationStrategy,SsdDiskOptimizationStrategy
public interface DiskOptimizationStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionintbufferSize(long recordSize) default introundBufferSize(long size) Round up to the next multiple of 4k but no more thanMAX_BUFFER_SIZE.static introundForCaching(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_SIZEandMAX_BUFFER_SIZE.
-
Field Details
-
MIN_BUFFER_SIZE
static final int MIN_BUFFER_SIZE- See Also:
-
MIN_BUFFER_SIZE_MASK
static final int MIN_BUFFER_SIZE_MASK- See Also:
-
MAX_BUFFER_SIZE
static final int MAX_BUFFER_SIZE- See Also:
-
-
Method Details
-
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_SIZEandMAX_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_SIZEor smaller thanMIN_BUFFER_SIZE.
-