Package org.apache.cassandra.io.compress
Class ZstdCompressor
java.lang.Object
org.apache.cassandra.io.compress.ZstdCompressor
- All Implemented Interfaces:
ICompressor
ZSTD Compressor
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.io.compress.ICompressor
ICompressor.Uses -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidcompress(ByteBuffer input, ByteBuffer output) Compress using ByteBuffersstatic ZstdCompressorCreate a Zstd compressor with the given optionsintstatic ZstdCompressorgetOrCreate(int level) Get a cached instance or return a new oneintinitialCompressedBufferLength(int chunkLength) Get initial compressed buffer lengthReturn the preferred BufferTypeHints to Cassandra which uses this compressor is recommended for.Lists the supported options by this compressorbooleansupports(BufferType bufferType) Check whether the given BufferType is supportedintuncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) Decompress data using arraysvoiduncompress(ByteBuffer input, ByteBuffer output) Decompress data via ByteBuffers
-
Field Details
-
FAST_COMPRESSION_LEVEL
public static final int FAST_COMPRESSION_LEVEL -
BEST_COMPRESSION_LEVEL
public static final int BEST_COMPRESSION_LEVEL -
DEFAULT_COMPRESSION_LEVEL
public static final int DEFAULT_COMPRESSION_LEVEL- See Also:
-
COMPRESSION_LEVEL_OPTION_NAME
- See Also:
-
-
Method Details
-
create
Create a Zstd compressor with the given options- Parameters:
options-- Returns:
-
getOrCreate
Get a cached instance or return a new one- Parameters:
level-- Returns:
-
initialCompressedBufferLength
public int initialCompressedBufferLength(int chunkLength) Get initial compressed buffer length- Specified by:
initialCompressedBufferLengthin interfaceICompressor- Parameters:
chunkLength-- Returns:
-
uncompress
public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws IOException Decompress data using arrays- Specified by:
uncompressin interfaceICompressor- Parameters:
input-inputOffset-inputLength-output-outputOffset-- Returns:
- Throws:
IOException
-
uncompress
Decompress data via ByteBuffers- Specified by:
uncompressin interfaceICompressor- Parameters:
input-output-- Throws:
IOException
-
compress
Compress using ByteBuffers- Specified by:
compressin interfaceICompressor- Parameters:
input-output-- Throws:
IOException
-
preferredBufferType
Return the preferred BufferType- Specified by:
preferredBufferTypein interfaceICompressor- Returns:
-
supports
Check whether the given BufferType is supported- Specified by:
supportsin interfaceICompressor- Parameters:
bufferType-- Returns:
-
supportedOptions
Lists the supported options by this compressor- Specified by:
supportedOptionsin interfaceICompressor- Returns:
-
getCompressionLevel
public int getCompressionLevel() -
recommendedUses
Description copied from interface:ICompressorHints to Cassandra which uses this compressor is recommended for. For example a compression algorithm which gets good compression ratio may trade off too much compression speed to be useful in certain compression heavy use cases such as flushes or mutation hints. Note that Cassandra may ignore these recommendations, it is not a strict contract.- Specified by:
recommendedUsesin interfaceICompressor
-