Module: OMQ::Compression::Zstd

Defined in:
lib/omq/compression/zstd/codec.rb,
lib/omq/compression/zstd/version.rb,
lib/omq/compression/zstd/constants.rb,
lib/omq/compression/zstd/compressor.rb,
lib/omq/compression/zstd/connection.rb,
lib/omq/compression/zstd/engine_ext.rb,
lib/omq/compression/zstd/options_ext.rb

Defined Under Namespace

Modules: Codec, EngineExt, OptionsExt Classes: Compressor, Connection, DecompressedSizeExceedsMaxError, DictMismatchError, Error, MissingContentSizeError, ShortFrameError, UnknownSentinelError

Constant Summary collapse

VERSION =
"0.2.0"
SENTINEL_UNCOMPRESSED =
"\x00\x00\x00\x00".b.freeze
SENTINEL_ZSTD_FRAME =
"\x28\xB5\x2F\xFD".b.freeze
SENTINEL_SIZE =
4
PROPERTY_NAME =
"X-Compression"
DEFAULT_LEVEL =
-3
MIN_COMPRESS_BYTES_NO_DICT =
512
MIN_COMPRESS_BYTES_DICT =
64
AUTO_DICT_SAMPLE_COUNT =
1000
AUTO_DICT_SAMPLE_BYTES =
100 * 1024
AUTO_DICT_MAX_SAMPLE_LEN =
1024
DICT_FRAME_MAX_SIZE =
64 * 1024
PROFILE_NONE =
"zstd:none"
PROFILE_DICT_PREFIX =
"zstd:dict:sha1:"
PROFILE_DICT_INLINE =
"zstd:dict:inline"
PROFILE_DICT_AUTO =
"zstd:dict:auto"

Class Method Summary collapse

Class Method Details

.auto(level: DEFAULT_LEVEL, passive: false) ⇒ Object



26
27
28
# File 'lib/omq/compression/zstd/compressor.rb', line 26

def self.auto(level: DEFAULT_LEVEL, passive: false)
  Compressor.new mode: :dict_auto, dictionary: nil, level: level, passive: passive
end

.none(level: DEFAULT_LEVEL, passive: false) ⇒ Object



13
14
15
# File 'lib/omq/compression/zstd/compressor.rb', line 13

def self.none(level: DEFAULT_LEVEL, passive: false)
  Compressor.new mode: :none, dictionary: nil, level: level, passive: passive
end

.with_dictionary(bytes, inline: false, level: DEFAULT_LEVEL, passive: false) ⇒ Object



18
19
20
21
22
23
# File 'lib/omq/compression/zstd/compressor.rb', line 18

def self.with_dictionary(bytes, inline: false, level: DEFAULT_LEVEL, passive: false)
  Compressor.new mode: inline ? :dict_inline : :dict_static,
    dictionary: bytes,
    level:      level,
    passive:    passive
end