/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ package org.opensearch.index.codec.customcodecs; import org.apache.logging.log4j.Logger; import org.opensearch.common.settings.Setting; import org.opensearch.index.codec.CodecSettings; import org.opensearch.index.engine.EngineConfig; import org.opensearch.index.mapper.MapperService; /** * ZstdCodec provides ZSTD compressor using the zstd-jni library. */ public class ZstdCodec extends Lucene95CustomCodec implements CodecSettings { /** * Creates a new ZstdCodec instance with the default compression level. */ public ZstdCodec() { this(DEFAULT_COMPRESSION_LEVEL); } /** * Creates a new ZstdCodec instance. * * @param compressionLevel The compression level. */ public ZstdCodec(int compressionLevel) { super(Mode.ZSTD, compressionLevel); } public ZstdCodec(MapperService mapperService, Logger logger, int compressionLevel) { super(Mode.ZSTD, compressionLevel, mapperService, logger); } /** The name for this codec. */ @Override public String toString() { return getClass().getSimpleName(); } @Override public boolean supports(Setting setting) { return setting.equals(EngineConfig.INDEX_CODEC_COMPRESSION_LEVEL_SETTING); } }