Package org.apache.cassandra.schema
Class CompressionParams
- java.lang.Object
-
- org.apache.cassandra.schema.CompressionParams
-
public final class CompressionParams extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CHUNK_LENGTH_IN_KB
static java.lang.String
CHUNK_LENGTH_KB
Deprecated.static java.lang.String
CLASS
static java.lang.String
CRC_CHECK_CHANCE
Deprecated.static CompressionParams
DEFAULT
static int
DEFAULT_CHUNK_LENGTH
static double
DEFAULT_MIN_COMPRESS_RATIO
static java.lang.String
ENABLED
static java.lang.String
MIN_COMPRESS_RATIO
static CompressionParams
NOOP
static IVersionedSerializer<CompressionParams>
serializer
static java.lang.String
SSTABLE_COMPRESSION
Deprecated.
-
Constructor Summary
Constructors Constructor Description CompressionParams(java.lang.String sstableCompressorClass, int chunkLength, int maxCompressedLength, java.util.Map<java.lang.String,java.lang.String> otherOptions)
CompressionParams(java.lang.String sstableCompressorClass, java.util.Map<java.lang.String,java.lang.String> otherOptions, int chunkLength, double minCompressRatio)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
asMap()
int
chunkLength()
java.lang.String
chunkLengthInKB()
static boolean
containsSstableCompressionClass(java.util.Map<java.lang.String,java.lang.String> options)
Returnstrue
if the specified options contains the name of the compression class to be used,false
otherwise.CompressionParams
copy()
static ICompressor
createCompressor(ParameterizedClass compression)
static CompressionParams
deflate()
static CompressionParams
deflate(int chunkLength)
boolean
equals(java.lang.Object obj)
static CompressionParams
fromMap(java.util.Map<java.lang.String,java.lang.String> opts)
double
getCrcCheckChance()
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>
getOtherOptions()
ICompressor
getSstableCompressor()
Returns the SSTable compressor.int
hashCode()
boolean
isEnabled()
Checks if compression is enabled.static boolean
isEnabled(java.util.Map<java.lang.String,java.lang.String> options)
Returnstrue
if the options contains theenabled
option and that its value istrue
, otherwise returnsfalse
.java.lang.Class<? extends ICompressor>
klass()
static CompressionParams
lz4()
static CompressionParams
lz4(int chunkLength)
static CompressionParams
lz4(int chunkLength, int maxCompressedLength)
int
maxCompressedLength()
static CompressionParams
noCompression()
static CompressionParams
noop()
void
setCrcCheckChance(double crcCheckChance)
boolean
shouldCheckCrc()
static CompressionParams
snappy()
static CompressionParams
snappy(int chunkLength)
static CompressionParams
snappy(int chunkLength, double minCompressRatio)
void
validate()
static CompressionParams
zstd()
static CompressionParams
zstd(java.lang.Integer chunkLength)
-
-
-
Field Detail
-
DEFAULT_CHUNK_LENGTH
public static final int DEFAULT_CHUNK_LENGTH
- See Also:
- Constant Field Values
-
DEFAULT_MIN_COMPRESS_RATIO
public static final double DEFAULT_MIN_COMPRESS_RATIO
- See Also:
- Constant Field Values
-
serializer
public static final IVersionedSerializer<CompressionParams> serializer
-
CLASS
public static final java.lang.String CLASS
- See Also:
- Constant Field Values
-
CHUNK_LENGTH_IN_KB
public static final java.lang.String CHUNK_LENGTH_IN_KB
- See Also:
- Constant Field Values
-
ENABLED
public static final java.lang.String ENABLED
- See Also:
- Constant Field Values
-
MIN_COMPRESS_RATIO
public static final java.lang.String MIN_COMPRESS_RATIO
- See Also:
- Constant Field Values
-
DEFAULT
public static final CompressionParams DEFAULT
-
NOOP
public static final CompressionParams NOOP
-
SSTABLE_COMPRESSION
@Deprecated public static final java.lang.String SSTABLE_COMPRESSION
Deprecated.- See Also:
- Constant Field Values
-
CHUNK_LENGTH_KB
@Deprecated public static final java.lang.String CHUNK_LENGTH_KB
Deprecated.- See Also:
- Constant Field Values
-
CRC_CHECK_CHANCE
@Deprecated public static final java.lang.String CRC_CHECK_CHANCE
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompressionParams
public CompressionParams(java.lang.String sstableCompressorClass, java.util.Map<java.lang.String,java.lang.String> otherOptions, int chunkLength, double minCompressRatio) throws ConfigurationException
- Throws:
ConfigurationException
-
CompressionParams
public CompressionParams(java.lang.String sstableCompressorClass, int chunkLength, int maxCompressedLength, java.util.Map<java.lang.String,java.lang.String> otherOptions) throws ConfigurationException
- Throws:
ConfigurationException
-
-
Method Detail
-
fromMap
public static CompressionParams fromMap(java.util.Map<java.lang.String,java.lang.String> opts)
-
klass
public java.lang.Class<? extends ICompressor> klass()
-
noCompression
public static CompressionParams noCompression()
-
snappy
public static CompressionParams snappy()
-
snappy
public static CompressionParams snappy(int chunkLength)
-
snappy
public static CompressionParams snappy(int chunkLength, double minCompressRatio)
-
deflate
public static CompressionParams deflate()
-
deflate
public static CompressionParams deflate(int chunkLength)
-
lz4
public static CompressionParams lz4()
-
lz4
public static CompressionParams lz4(int chunkLength)
-
lz4
public static CompressionParams lz4(int chunkLength, int maxCompressedLength)
-
zstd
public static CompressionParams zstd()
-
zstd
public static CompressionParams zstd(java.lang.Integer chunkLength)
-
noop
public static CompressionParams noop()
-
copy
public CompressionParams copy()
-
isEnabled
public boolean isEnabled()
Checks if compression is enabled.- Returns:
true
if compression is enabled,false
otherwise.
-
getSstableCompressor
public ICompressor getSstableCompressor()
Returns the SSTable compressor.- Returns:
- the SSTable compressor or
null
if compression is disabled.
-
getOtherOptions
public com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> getOtherOptions()
-
chunkLength
public int chunkLength()
-
maxCompressedLength
public int maxCompressedLength()
-
createCompressor
public static ICompressor createCompressor(ParameterizedClass compression) throws ConfigurationException
- Throws:
ConfigurationException
-
containsSstableCompressionClass
public static boolean containsSstableCompressionClass(java.util.Map<java.lang.String,java.lang.String> options)
Returnstrue
if the specified options contains the name of the compression class to be used,false
otherwise.- Parameters:
options
- the options- Returns:
true
if the specified options contains the name of the compression class to be used,false
otherwise.
-
isEnabled
public static boolean isEnabled(java.util.Map<java.lang.String,java.lang.String> options)
Returnstrue
if the options contains theenabled
option and that its value istrue
, otherwise returnsfalse
.- Parameters:
options
- the options- Returns:
true
if the options contains theenabled
option and that its value istrue
, otherwise returnsfalse
.
-
validate
public void validate() throws ConfigurationException
- Throws:
ConfigurationException
-
asMap
public java.util.Map<java.lang.String,java.lang.String> asMap()
-
chunkLengthInKB
public java.lang.String chunkLengthInKB()
-
setCrcCheckChance
public void setCrcCheckChance(double crcCheckChance)
-
getCrcCheckChance
public double getCrcCheckChance()
-
shouldCheckCrc
public boolean shouldCheckCrc()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-