ddn.compressor.zstd
ddn.compressor.zstd
Zstandard (ZSTD) compression/decompression provider built on ddn-lib-zstd.
This module implements the streaming Compressor and Decompressor interfaces from ddn.api.compressor and registers itself under:
- Enum registry:
CompressionFormat.ZSTD - String registry: formatId "zstd" with provider name "lib-zstd"
The implementation uses libzstd's streaming API (ZSTD_compressStream2 / ZSTD_decompressStream) for true incremental compression and decompression.
Provider name convention: vendor "lib", toString() returns "lib-zstd".
Copyright
Module Initializers 1
()Types 2
ZSTD compressor that implements ddn.api.compressor.Compressor using libzstd's streaming API (ZSTD_compressStream2).
void setOutputSink(OutputSink sink)Set the output sink delegate.void setProgressCallback(ProgressCallback callback)Set the progress callback.void write(const(ubyte)[] data)Feed uncompressed data into the stream.void finish()Finalize the stream.void reset()Reset the compression context for reuse.bool setDictionary(const(ubyte)[] dict)Set a compression dictionary.this(CompressionOptions opts)Create a compressor with provided options.~thisRelease the ZSTD context.ZSTD decompressor that implements ddn.api.compressor.Decompressor using libzstd's streaming API (ZSTD_decompressStream).
Supports concatenated zstd frames: when input contains multiple frames concatenated together, all frames are decompressed in sequence. Trailing bytes that do not form a valid zstd frame are rejected with a CompressionError.
void setOutputSink(OutputSink sink)Set the output sink delegate.void setProgressCallback(ProgressCallback callback)Set the progress callback.void write(const(ubyte)[] data)Feed compressed data into the stream.void finish()Finalize the stream.void reset()Reset the decompression context for reuse.bool setDictionary(const(ubyte)[] dict)Provide a dictionary if required.this(DecompressionOptions opts)Create a decompressor with provided options.~thisRelease the ZSTD context.Functions 2
Compressor makeZstdCompressor(CompressionOptions opts)Factory function that constructs a `ZstdCompressor`.Decompressor makeZstdDecompressor(DecompressionOptions opts)Factory function that constructs a `ZstdDecompressor`.