Class ZstdCompressor

java.lang.Object
org.apache.cassandra.io.compress.ZstdCompressor
All Implemented Interfaces:
ICompressor

public class ZstdCompressor extends Object implements ICompressor
ZSTD Compressor
  • 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

      public static final String COMPRESSION_LEVEL_OPTION_NAME
      See Also:
  • Method Details

    • create

      public static ZstdCompressor create(Map<String,String> options)
      Create a Zstd compressor with the given options
      Parameters:
      options -
      Returns:
    • getOrCreate

      public static ZstdCompressor getOrCreate(int level)
      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:
      initialCompressedBufferLength in interface ICompressor
      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:
      uncompress in interface ICompressor
      Parameters:
      input -
      inputOffset -
      inputLength -
      output -
      outputOffset -
      Returns:
      Throws:
      IOException
    • uncompress

      public void uncompress(ByteBuffer input, ByteBuffer output) throws IOException
      Decompress data via ByteBuffers
      Specified by:
      uncompress in interface ICompressor
      Parameters:
      input -
      output -
      Throws:
      IOException
    • compress

      public void compress(ByteBuffer input, ByteBuffer output) throws IOException
      Compress using ByteBuffers
      Specified by:
      compress in interface ICompressor
      Parameters:
      input -
      output -
      Throws:
      IOException
    • preferredBufferType

      public BufferType preferredBufferType()
      Return the preferred BufferType
      Specified by:
      preferredBufferType in interface ICompressor
      Returns:
    • supports

      public boolean supports(BufferType bufferType)
      Check whether the given BufferType is supported
      Specified by:
      supports in interface ICompressor
      Parameters:
      bufferType -
      Returns:
    • supportedOptions

      public Set<String> supportedOptions()
      Lists the supported options by this compressor
      Specified by:
      supportedOptions in interface ICompressor
      Returns:
    • getCompressionLevel

      public int getCompressionLevel()
    • recommendedUses

      public Set<ICompressor.Uses> recommendedUses()
      Description copied from interface: ICompressor
      Hints 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:
      recommendedUses in interface ICompressor