MCPcopy Create free account
hub / github.com/apache/arrow / CreateCCtx

Method CreateCCtx

cpp/src/arrow/util/compression_zstd.cc:229–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228 private:
229 Result<CCtxPtr> CreateCCtx() const {
230 CCtxPtr cctx{ZSTD_createCCtx(), ZSTD_freeCCtx};
231 if (cctx == nullptr) {
232 return Status::OutOfMemory("ZSTD_CCtx create failed");
233 }
234 auto ret =
235 ZSTD_CCtx_setParameter(cctx.get(), ZSTD_c_compressionLevel, compression_level_);
236 if (ZSTD_isError(ret)) {
237 return ZSTDError(ret, "ZSTD_CCtx create failed: ");
238 }
239 for (auto& [key, value] : compression_context_params_) {
240 ret = ZSTD_CCtx_setParameter(cctx.get(), static_cast<ZSTD_cParameter>(key), value);
241 if (ZSTD_isError(ret)) {
242 return ZSTDError(ret, "ZSTD_CCtx create failed: ");
243 }
244 }
245 return cctx;
246 }
247
248 Result<DCtxPtr> CreateDCtx() const {
249 DCtxPtr dctx{ZSTD_createDCtx(), ZSTD_freeDCtx};

Callers

nothing calls this directly

Calls 3

OutOfMemoryFunction · 0.85
ZSTDErrorFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected