Class: Cassandra::Compression::Compressor Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra/compression.rb

Overview

This class is 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.

Instance Method Summary collapse

Instance Method Details

#algorithmString

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

Returns:

  • (String)

    algorithm



# File 'lib/cassandra/compression.rb', line 25

#compress(frame) ⇒ String

Compresses the raw bytes of a frame.

Parameters:

  • frame (String)

    the bytes of the frame to be compressed

Returns:

  • (String)

    the compressed frame



# File 'lib/cassandra/compression.rb', line 50

#compress?(frame) ⇒ true, false

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:

  • frame (String)

    the bytes of the frame to be compressed

Returns:

  • (true, false)

    whether to perform compression or not



# File 'lib/cassandra/compression.rb', line 32

#decompress(compressed_frame) ⇒ String

Decompresses the raw bytes of a compressed frame.

Parameters:

  • compressed_frame (String)

    the bytes of the compressed frame to be uncompressed

Returns:

  • (String)

    uncompressed bytes



# File 'lib/cassandra/compression.rb', line 57