Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ opensearchplugin {

dependencies {
api "com.github.luben:zstd-jni:1.5.6-1"
api "com.intel.qat:qat-java:2.3.2"
api "com.intel.qat:qat-java:2.4.0"
}

allprojects {
Expand Down
1 change: 0 additions & 1 deletion licenses/qat-java-2.3.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions licenses/qat-java-2.4.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3f0706b2406972f2d32a65c553fd0f5d745d8431
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private void compress(byte[] bytes, int offset, int length, DataOutput out) thro
}

final int maxCompressedLength = qatZipper.maxCompressedLength(l);
compressedBuffer = ArrayUtil.grow(compressedBuffer, maxCompressedLength);
compressedBuffer = ArrayUtil.growNoCopy(compressedBuffer, maxCompressedLength);

int compressedSize = qatZipper.compress(bytes, start, l, compressedBuffer, 0, compressedBuffer.length);
out.writeVInt(compressedSize);
Expand Down Expand Up @@ -180,7 +180,7 @@ public void decompress(DataInput in, int originalLength, int offset, int length,
if (compressedLength == 0) {
return;
}
compressed = ArrayUtil.grow(compressed, compressedLength);
compressed = ArrayUtil.growNoCopy(compressed, compressedLength);
in.readBytes(compressed, 0, compressedLength);

int l = Math.min(blockLength, originalLength - offsetInBlock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import com.intel.qat.QatZipper;

import static com.intel.qat.QatZipper.Algorithm;
import static com.intel.qat.QatZipper.DEFAULT_COMPRESS_LEVEL;
import static com.intel.qat.QatZipper.DEFAULT_COMPRESSION_LEVEL_DEFLATE;
import static com.intel.qat.QatZipper.DEFAULT_COMPRESSION_LEVEL_ZSTD;
import static com.intel.qat.QatZipper.DEFAULT_MODE;
import static com.intel.qat.QatZipper.DEFAULT_POLLING_MODE;
import static com.intel.qat.QatZipper.DEFAULT_RETRY_COUNT;
Expand All @@ -31,20 +32,33 @@ public class QatZipperFactory {
* @param pmode polling mode.
*/
public static QatZipper createInstance(Algorithm algorithm, int level, Mode mode, int retryCount, PollingMode pmode) {
return new QatZipper.Builder().setAlgorithm(algorithm)
.setLevel(level)
.setMode(mode)
.setRetryCount(retryCount)
.setPollingMode(pmode)
.build();
return new QatZipper.Builder().algorithm(algorithm).level(level).mode(mode).retryCount(retryCount).pollingMode(pmode).build();
}

/**
* Creates a new QatZipper with the specified parameters. The default compression level for the algorithm is used.
*
* @param algorithm the compression algorithm
* @param mode the mode of QAT execution
* @param retryCount the number of attempts to acquire hardware resources
* @param pmode polling mode.
*/
public static QatZipper createInstance(Algorithm algorithm, Mode mode, int retryCount, PollingMode pmode) {
return createInstance(
algorithm,
algorithm == Algorithm.ZSTD ? DEFAULT_COMPRESSION_LEVEL_ZSTD : DEFAULT_COMPRESSION_LEVEL_DEFLATE,
mode,
retryCount,
pmode
);
}

/**
* Creates a new QatZipper that uses the DEFLATE algorithm and the default compression level,
* mode, retry count, and polling mode.
*/
public static QatZipper createInstance() {
return createInstance(Algorithm.DEFLATE, DEFAULT_COMPRESS_LEVEL, DEFAULT_MODE, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
return createInstance(Algorithm.DEFLATE, DEFAULT_MODE, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
}

/**
Expand All @@ -54,7 +68,7 @@ public static QatZipper createInstance() {
* @param algorithm the compression algorithm
*/
public static QatZipper createInstance(Algorithm algorithm) {
return createInstance(algorithm, DEFAULT_COMPRESS_LEVEL, DEFAULT_MODE, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
return createInstance(algorithm, DEFAULT_MODE, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
}

/**
Expand All @@ -64,7 +78,7 @@ public static QatZipper createInstance(Algorithm algorithm) {
* @param mode the mode of QAT execution
*/
public static QatZipper createInstance(Mode mode) {
return createInstance(Algorithm.DEFLATE, DEFAULT_COMPRESS_LEVEL, mode, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
return createInstance(Algorithm.DEFLATE, mode, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
}

/**
Expand All @@ -74,7 +88,7 @@ public static QatZipper createInstance(Mode mode) {
* @param pmode the polling mode.
*/
public static QatZipper createInstance(PollingMode pmode) {
return createInstance(Algorithm.DEFLATE, DEFAULT_COMPRESS_LEVEL, DEFAULT_MODE, DEFAULT_RETRY_COUNT, pmode);
return createInstance(Algorithm.DEFLATE, DEFAULT_MODE, DEFAULT_RETRY_COUNT, pmode);
}

/**
Expand All @@ -96,7 +110,7 @@ public static QatZipper createInstance(Algorithm algorithm, int level) {
* @param mode the mode of QAT execution
*/
public static QatZipper createInstance(Algorithm algorithm, Mode mode) {
return createInstance(algorithm, DEFAULT_COMPRESS_LEVEL, mode, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
return createInstance(algorithm, mode, DEFAULT_RETRY_COUNT, DEFAULT_POLLING_MODE);
}

/**
Expand All @@ -107,7 +121,7 @@ public static QatZipper createInstance(Algorithm algorithm, Mode mode) {
* @param pmode the polling mode.
*/
public static QatZipper createInstance(Algorithm algorithm, PollingMode pmode) {
return createInstance(algorithm, DEFAULT_COMPRESS_LEVEL, DEFAULT_MODE, DEFAULT_RETRY_COUNT, pmode);
return createInstance(algorithm, DEFAULT_MODE, DEFAULT_RETRY_COUNT, pmode);
}

/**
Expand All @@ -119,7 +133,7 @@ public static QatZipper createInstance(Algorithm algorithm, PollingMode pmode) {
* @param pmode the polling mode.
*/
public static QatZipper createInstance(Algorithm algorithm, Mode mode, PollingMode pmode) {
return createInstance(algorithm, DEFAULT_COMPRESS_LEVEL, mode, DEFAULT_RETRY_COUNT, pmode);
return createInstance(algorithm, mode, DEFAULT_RETRY_COUNT, pmode);
}

/**
Expand Down
Loading