2017-03-30 21:04:09 +02:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2017-03-30 21:04:09 +02:00
|
|
|
//
|
|
|
|
// This file implements the "bridge" between Java and C++ for
|
2020-02-20 21:07:53 +01:00
|
|
|
// ROCKSDB_NAMESPACE::CompactionOptionsUniversal.
|
2017-03-30 21:04:09 +02:00
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
#include "include/org_rocksdb_CompactionOptionsUniversal.h"
|
|
|
|
#include "rocksdb/advanced_options.h"
|
2022-03-01 18:02:15 +01:00
|
|
|
#include "rocksjni/cplusplus_to_java_convert.h"
|
2017-03-30 21:04:09 +02:00
|
|
|
#include "rocksjni/portal.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: newCompactionOptionsUniversal
|
|
|
|
* Signature: ()J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_CompactionOptionsUniversal_newCompactionOptionsUniversal(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jclass) {
|
2020-02-20 21:07:53 +01:00
|
|
|
const auto* opt = new ROCKSDB_NAMESPACE::CompactionOptionsUniversal();
|
2022-03-01 18:02:15 +01:00
|
|
|
return GET_CPLUSPLUS_POINTER(opt);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setSizeRatio
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setSizeRatio(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jsize_ratio) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->size_ratio = static_cast<unsigned int>(jsize_ratio);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: sizeRatio
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_CompactionOptionsUniversal_sizeRatio(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jint>(opt->size_ratio);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setMinMergeWidth
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setMinMergeWidth(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmin_merge_width) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->min_merge_width = static_cast<unsigned int>(jmin_merge_width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: minMergeWidth
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_CompactionOptionsUniversal_minMergeWidth(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jint>(opt->min_merge_width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setMaxMergeWidth
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setMaxMergeWidth(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmax_merge_width) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->max_merge_width = static_cast<unsigned int>(jmax_merge_width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: maxMergeWidth
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_CompactionOptionsUniversal_maxMergeWidth(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jint>(opt->max_merge_width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setMaxSizeAmplificationPercent
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setMaxSizeAmplificationPercent(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmax_size_amplification_percent) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->max_size_amplification_percent =
|
|
|
|
static_cast<unsigned int>(jmax_size_amplification_percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: maxSizeAmplificationPercent
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_CompactionOptionsUniversal_maxSizeAmplificationPercent(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jint>(opt->max_size_amplification_percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setCompressionSizePercent
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setCompressionSizePercent(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jint jcompression_size_percent) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->compression_size_percent =
|
|
|
|
static_cast<unsigned int>(jcompression_size_percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: compressionSizePercent
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_CompactionOptionsUniversal_compressionSizePercent(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jint>(opt->compression_size_percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setStopStyle
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setStopStyle(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jstop_style_value) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
|
|
|
opt->stop_style =
|
|
|
|
ROCKSDB_NAMESPACE::CompactionStopStyleJni::toCppCompactionStopStyle(
|
|
|
|
jstop_style_value);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: stopStyle
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_CompactionOptionsUniversal_stopStyle(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
|
|
|
return ROCKSDB_NAMESPACE::CompactionStopStyleJni::toJavaCompactionStopStyle(
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->stop_style);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: setAllowTrivialMove
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_setAllowTrivialMove(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_trivial_move) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->allow_trivial_move = static_cast<bool>(jallow_trivial_move);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: allowTrivialMove
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_CompactionOptionsUniversal_allowTrivialMove(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* opt =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return opt->allow_trivial_move;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CompactionOptionsUniversal
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CompactionOptionsUniversal_disposeInternal(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
delete reinterpret_cast<ROCKSDB_NAMESPACE::CompactionOptionsUniversal*>(
|
|
|
|
jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|