Abstract
Compressors given to Cassandra.cluster as the :compressor option don’t need to be subclasses of this class, but need to implement the same methods. This class exists only for documentation purposes.

Inherits

Object

Direct Known Subclasses

Methods

algorithm

Returns the name of the algorithm this compressor supports, e.g. “snappy” or “lz4”.

Returns:
Type Details
String algorithm

compress?

(frame)

Before compressing a frame the compressor will be asked if it wants to compress it or not. One reason it could say no is if the frame is small enough that compression would be unlikely to decrease its size.

If your operations consist mostly of small prepared statement executions it might not be useful to compress the frames being sent to Cassandra, but enabling compression can still be useful on the frames coming from Cassandra. Making this method always return false disables request compression, but will still make the client tell Cassandra that it supports compressed frames.

The bytes given to #compress? are the same as to #compress

Parameters:
Name Type Details
frame String the bytes of the frame to be compressed
Returns:
Type Details
(true or false) whether to perform compression or not

compress

(frame)

Compresses the raw bytes of a frame.

Parameters:
Name Type Details
frame String the bytes of the frame to be compressed
Returns:
Type Details
String the compressed frame

decompress

(compressed_frame)

Decompresses the raw bytes of a compressed frame.

Parameters:
Name Type Details
compressed_frame String the bytes of the compressed frame to be uncompressed
Returns:
Type Details
String uncompressed bytes