comparison contrib/python-zstandard/c-ext/python-zstandard.h @ 40121:73fef626dae3

zstandard: vendor python-zstandard 0.10.1 This was just released. The upstream source distribution from PyPI was extracted. Unwanted files were removed. The clang-format ignore list was updated to reflect the new source of files. setup.py was updated to pass a new argument to python-zstandard's function for returning an Extension instance. Upstream had to change to use relative paths because Python 3.7's packaging doesn't seem to like absolute paths when defining sources, includes, etc. The default relative path calculation is relative to setup_zstd.py which is different from the directory of Mercurial's setup.py. The project contains a vendored copy of zstandard 1.3.6. The old version was 1.3.4. The API should be backwards compatible and nothing in core should need adjusted. However, there is a new "chunker" API that we may find useful in places where we want to emit compressed chunks of a fixed size. There are a pair of bug fixes in 0.10.0 with regards to compressobj() and decompressobj() when block flushing is used. I actually found these bugs when introducing these APIs in Mercurial! But existing Mercurial code is not affected because we don't perform block flushing. # no-check-commit because 3rd party code has different style guidelines Differential Revision: https://phab.mercurial-scm.org/D4911
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 08 Oct 2018 16:27:40 -0700
parents b1fb341d8a61
children 675775c33ab6
comparison
equal deleted inserted replaced
40120:89742f1fa6cb 40121:73fef626dae3
13 #define ZSTD_STATIC_LINKING_ONLY 13 #define ZSTD_STATIC_LINKING_ONLY
14 #define ZDICT_STATIC_LINKING_ONLY 14 #define ZDICT_STATIC_LINKING_ONLY
15 #include <zstd.h> 15 #include <zstd.h>
16 #include <zdict.h> 16 #include <zdict.h>
17 17
18 #define PYTHON_ZSTANDARD_VERSION "0.9.0" 18 /* Remember to change the string in zstandard/__init__ as well */
19 #define PYTHON_ZSTANDARD_VERSION "0.10.1"
19 20
20 typedef enum { 21 typedef enum {
21 compressorobj_flush_finish, 22 compressorobj_flush_finish,
22 compressorobj_flush_block, 23 compressorobj_flush_block,
23 } CompressorObj_Flush; 24 } CompressorObj_Flush;
43 unsigned checksumFlag; 44 unsigned checksumFlag;
44 unsigned dictIDFlag; 45 unsigned dictIDFlag;
45 unsigned threads; 46 unsigned threads;
46 unsigned jobSize; 47 unsigned jobSize;
47 unsigned overlapSizeLog; 48 unsigned overlapSizeLog;
48 unsigned compressLiterals;
49 unsigned forceMaxWindow; 49 unsigned forceMaxWindow;
50 unsigned enableLongDistanceMatching; 50 unsigned enableLongDistanceMatching;
51 unsigned ldmHashLog; 51 unsigned ldmHashLog;
52 unsigned ldmMinMatch; 52 unsigned ldmMinMatch;
53 unsigned ldmBucketSizeLog; 53 unsigned ldmBucketSizeLog;
160 PyObject_HEAD 160 PyObject_HEAD
161 161
162 ZstdCompressor* compressor; 162 ZstdCompressor* compressor;
163 PyObject* reader; 163 PyObject* reader;
164 Py_buffer buffer; 164 Py_buffer buffer;
165 unsigned long long sourceSize;
166 size_t readSize; 165 size_t readSize;
167 166
168 int entered; 167 int entered;
169 int closed; 168 int closed;
170 unsigned long long bytesCompressed; 169 unsigned long long bytesCompressed;
175 int finishedOutput; 174 int finishedOutput;
176 PyObject* readResult; 175 PyObject* readResult;
177 } ZstdCompressionReader; 176 } ZstdCompressionReader;
178 177
179 extern PyTypeObject ZstdCompressionReaderType; 178 extern PyTypeObject ZstdCompressionReaderType;
179
180 typedef struct {
181 PyObject_HEAD
182
183 ZstdCompressor* compressor;
184 ZSTD_inBuffer input;
185 ZSTD_outBuffer output;
186 Py_buffer inBuffer;
187 int finished;
188 size_t chunkSize;
189 } ZstdCompressionChunker;
190
191 extern PyTypeObject ZstdCompressionChunkerType;
192
193 typedef enum {
194 compressionchunker_mode_normal,
195 compressionchunker_mode_flush,
196 compressionchunker_mode_finish,
197 } CompressionChunkerMode;
198
199 typedef struct {
200 PyObject_HEAD
201
202 ZstdCompressionChunker* chunker;
203 CompressionChunkerMode mode;
204 } ZstdCompressionChunkerIterator;
205
206 extern PyTypeObject ZstdCompressionChunkerIteratorType;
180 207
181 typedef struct { 208 typedef struct {
182 PyObject_HEAD 209 PyObject_HEAD
183 210
184 ZSTD_DCtx* dctx; 211 ZSTD_DCtx* dctx;