MCPcopy Create free account
hub / github.com/ByConity/ByConity / finishImpl

Method finishImpl

src/IO/ZstdDeflatingAppendableWriteBuffer.cpp:140–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void ZstdDeflatingAppendableWriteBuffer::finishImpl()
141{
142 next();
143
144 out.nextIfAtEnd();
145
146 input.src = reinterpret_cast<unsigned char *>(working_buffer.begin());
147 input.size = offset();
148 input.pos = 0;
149
150 output.dst = reinterpret_cast<unsigned char *>(out.buffer().begin());
151 output.size = out.buffer().size();
152 output.pos = out.offset();
153
154 size_t remaining = ZSTD_compressStream2(cctx, &output, &input, ZSTD_e_end);
155 while (remaining != 0)
156 {
157 if (ZSTD_isError(remaining))
158 throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "Zstd stream encoder end failed: error: '{}' zstd version: {}", ZSTD_getErrorName(remaining), ZSTD_VERSION_STRING);
159
160 remaining = ZSTD_compressStream2(cctx, &output, &input, ZSTD_e_end);
161 }
162 out.position() = out.buffer().begin() + output.pos;
163}
164
165void ZstdDeflatingAppendableWriteBuffer::addEmptyBlock()
166{

Callers

nothing calls this directly

Calls 7

bufferMethod · 0.80
ExceptionClass · 0.50
nextIfAtEndMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
offsetMethod · 0.45
positionMethod · 0.45

Tested by

no test coverage detected