Project Alice
Loading...
Searching...
No Matches
zstdmt_compress.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
9 */
10
11 #ifndef ZSTDMT_COMPRESS_H
12 #define ZSTDMT_COMPRESS_H
13
14 #if defined (__cplusplus)
15 extern "C" {
16 #endif
17
18
19/* Note : This is an internal API.
20 * These APIs used to be exposed with ZSTDLIB_API,
21 * because it used to be the only way to invoke MT compression.
22 * Now, you must use ZSTD_compress2 and ZSTD_compressStream2() instead.
23 *
24 * This API requires ZSTD_MULTITHREAD to be defined during compilation,
25 * otherwise ZSTDMT_createCCtx*() will fail.
26 */
27
28/* === Dependencies === */
29#include "../common/zstd_deps.h" /* size_t */
30#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters */
31#include "../zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */
32
33
34/* === Constants === */
35#ifndef ZSTDMT_NBWORKERS_MAX /* a different value can be selected at compile time */
36# define ZSTDMT_NBWORKERS_MAX ((sizeof(void*)==4) /*32-bit*/ ? 64 : 256)
37#endif
38#ifndef ZSTDMT_JOBSIZE_MIN /* a different value can be selected at compile time */
39# define ZSTDMT_JOBSIZE_MIN (512 KB)
40#endif
41#define ZSTDMT_JOBLOG_MAX (MEM_32bits() ? 29 : 30)
42#define ZSTDMT_JOBSIZE_MAX (MEM_32bits() ? (512 MB) : (1024 MB))
43
44
45/* ========================================================
46 * === Private interface, for use by ZSTD_compress.c ===
47 * === Not exposed in libzstd. Never invoke directly ===
48 * ======================================================== */
49
50/* === Memory management === */
52/* Requires ZSTD_MULTITHREAD to be defined during compilation, otherwise it will return NULL. */
53ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers,
54 ZSTD_customMem cMem,
55 ZSTD_threadPool *pool);
56size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx);
57
58size_t ZSTDMT_sizeof_CCtx(ZSTDMT_CCtx* mtctx);
59
60/* === Streaming functions === */
61
62size_t ZSTDMT_nextInputSizeHint(const ZSTDMT_CCtx* mtctx);
63
73 const void* dict, size_t dictSize, ZSTD_dictContentType_e dictContentType,
74 const ZSTD_CDict* cdict,
75 ZSTD_CCtx_params params, unsigned long long pledgedSrcSize);
76
85 ZSTD_outBuffer* output,
86 ZSTD_inBuffer* input,
87 ZSTD_EndDirective endOp);
88
95size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx* mtctx);
96
100void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx* mtctx, const ZSTD_CCtx_params* cctxParams);
101
106ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx);
107
108
109#if defined (__cplusplus)
110}
111#endif
112
113#endif /* ZSTDMT_COMPRESS_H */
ZSTD_customMem cMem
const ZSTD_CDict * cdict
ZSTD_CCtx_params params
ZSTD_EndDirective
Definition: zstd.h:760
size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx *mtctx)
size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx *mtctx, ZSTD_outBuffer *output, ZSTD_inBuffer *input, ZSTD_EndDirective endOp)
ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx *mtctx)
void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx *mtctx, const ZSTD_CCtx_params *cctxParams)
size_t ZSTDMT_nextInputSizeHint(const ZSTDMT_CCtx *mtctx)
size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx *mtctx)
size_t ZSTDMT_sizeof_CCtx(ZSTDMT_CCtx *mtctx)
size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx *mtctx, const void *dict, size_t dictSize, ZSTD_dictContentType_e dictContentType, const ZSTD_CDict *cdict, ZSTD_CCtx_params params, unsigned long long pledgedSrcSize)
ZSTDMT_CCtx * ZSTDMT_createCCtx_advanced(unsigned nbWorkers, ZSTD_customMem cMem, ZSTD_threadPool *pool)