folly::compression

Compression and decompression codecs over IOBufs.

Namespaces

NameDescription
contexts Process-wide singleton ZSTD compression context pools.
instructions CPU instruction-set backends for Elias-Fano bit operations.

Types

NameDescription
BitVectorCompressedListBase Non-owning view over a bit-vector-encoded list and its sub-sections.
BitVectorEncoder Encodes a strictly increasing sequence of unsigned integers as a bit vector.
BitVectorReader Forward/random-access reader over a bit-vector-encoded integer sequence.
Codec Base class for a compression/decompression codec.
CompressionContextPool This implementation is slow under contention. Except under uncontended scenarios, you shouldn't use it directly. You likely want to use the CompressionCoreLocalContextPool instead, which, behind the fast cache slots, is backed by this implementation.
CompressionContextPoolDefaultCallback Default no-op callback invoked periodically by CompressionContextPool.
CompressionCoreLocalContextPool This class is intended to reduce contention on reserving a compression context and improve cache locality (but maybe not hotness) of the contexts it manages.
CompressionCoreLocalContextPoolBase Non-templated base class which allows for generic interaction with context pool instances.
EliasFanoCompressedListBase Non-owning view over an Elias-Fano-encoded list and its sub-sections.
EliasFanoEncoder Encodes a sorted sequence of unsigned integers using Elias-Fano coding.
EliasFanoReader Forward/random-access reader over an Elias-Fano-encoded, non-decreasing sequence of integers produced by EliasFanoEncoder.
StreamCodec Base class for a codec that also supports a stateful streaming API.

Type Aliases

NameDescription
BitVectorCompressedList Read-only bit-vector compressed list.
EliasFanoCompressedList Read-only Elias-Fano compressed list.
MutableBitVectorCompressedList Mutable bit-vector compressed list.
MutableEliasFanoCompressedList Mutable Elias-Fano compressed list.

Enums

NameDescription
CodecType Identifies a compression algorithm.

Functions

NameDescription
copyCompressedList Returns a deep copy of a compressed list, owning a freshly allocated buffer.
getAutoUncompressionCodec Returns a codec that can uncompress any of the given codec types as well as {LZ4_FRAME, ZSTD, ZLIB, GZIP, LZMA2, BZIP2}. Appends each default codec to customCodecs in order, so long as a codec with the same type() isn't already present in customCodecs or as the terminalCodec. When uncompress() is called, each codec's canUncompress() is called in the order that they are given. Appended default codecs are checked last. uncompress() is called on the first codec whose canUncompress() returns true.
getCodec Return a codec for the given type. Throws on error. The level is a non-negative codec-dependent integer indicating the level of compression desired, or one of the following constants:
getStreamCodec Return a codec for the given type. Throws on error. The level is a non-negative codec-dependent integer indicating the level of compression desired, or one of the following constants:
hasCodec Check if a specified codec is supported.
hasStreamCodec Check if a specified codec is supported and supports streaming.
zstdConvertLevel Convert a folly abstract compression level (COMPRESSION_LEVEL_FASTEST, COMPRESSION_LEVEL_DEFAULT, COMPRESSION_LEVEL_BEST) to a raw ZSTD compression level (1-22). Passes through raw levels in [1, ZSTD_maxCLevel()] unchanged. Throws std::invalid_argument for out-of-range levels.

Variables

NameDescription
COMPRESSION_CONTEXT_POOL_CALLBACK_INTERVAL Number of pool checkouts between successive callback invocations.
COMPRESSION_LEVEL_BEST Abstract level selecting the best compression.
COMPRESSION_LEVEL_DEFAULT Abstract level selecting the codec's default compression.
COMPRESSION_LEVEL_FASTEST Abstract level selecting the fastest compression.
kCacheLineSize Size in bytes of a cache line, used to size prefetches.
kLowerTrailingBytes Trailing bytes that must be readable past the end of the lower bit sequence, required by loadUnaligned<uint64_t> reads in the lower accessor.
kUpperTrailingBytes Trailing bytes that must be readable past the end of the upper bit sequence, required by loadUnaligned<uint64_t> reads in the upper accessor.