// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. // 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). // // This file implements the "bridge" between Java and C++ for // rocksdb::CompactionOptionsUniversal. #include #include "include/org_rocksdb_CompactionOptionsUniversal.h" #include "rocksdb/advanced_options.h" #include "rocksjni/portal.h" /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: newCompactionOptionsUniversal * Signature: ()J */ jlong Java_org_rocksdb_CompactionOptionsUniversal_newCompactionOptionsUniversal( JNIEnv* /*env*/, jclass /*jcls*/) { const auto* opt = new rocksdb::CompactionOptionsUniversal(); return reinterpret_cast(opt); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setSizeRatio * Signature: (JI)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setSizeRatio( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint jsize_ratio) { auto* opt = reinterpret_cast(jhandle); opt->size_ratio = static_cast(jsize_ratio); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: sizeRatio * Signature: (J)I */ jint Java_org_rocksdb_CompactionOptionsUniversal_sizeRatio(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->size_ratio); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setMinMergeWidth * Signature: (JI)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setMinMergeWidth( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint jmin_merge_width) { auto* opt = reinterpret_cast(jhandle); opt->min_merge_width = static_cast(jmin_merge_width); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: minMergeWidth * Signature: (J)I */ jint Java_org_rocksdb_CompactionOptionsUniversal_minMergeWidth(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->min_merge_width); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setMaxMergeWidth * Signature: (JI)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxMergeWidth( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint jmax_merge_width) { auto* opt = reinterpret_cast(jhandle); opt->max_merge_width = static_cast(jmax_merge_width); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: maxMergeWidth * Signature: (J)I */ jint Java_org_rocksdb_CompactionOptionsUniversal_maxMergeWidth(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_merge_width); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setMaxSizeAmplificationPsrcent * Signature: (JI)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxSizeAmplificationPsrcent( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint jmax_size_amplification_psrcent) { auto* opt = reinterpret_cast(jhandle); opt->max_size_amplification_psrcent = static_cast(jmax_size_amplification_psrcent); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: maxSizeAmplificationPsrcent * Signature: (J)I */ jint Java_org_rocksdb_CompactionOptionsUniversal_maxSizeAmplificationPsrcent( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_size_amplification_psrcent); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setCompressionSizePsrcent * Signature: (JI)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setCompressionSizePsrcent( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint jcompression_size_psrcent) { auto* opt = reinterpret_cast(jhandle); opt->compression_size_psrcent = static_cast(jcompression_size_psrcent); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: compressionSizePsrcent * Signature: (J)I */ jint Java_org_rocksdb_CompactionOptionsUniversal_compressionSizePsrcent( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->compression_size_psrcent); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setStopStyle * Signature: (JB)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setStopStyle( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jbyte jstop_style_value) { auto* opt = reinterpret_cast(jhandle); opt->stop_style = rocksdb::CompactionStopStyleJni::toCppCompactionStopStyle( jstop_style_value); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: stopStyle * Signature: (J)B */ jbyte Java_org_rocksdb_CompactionOptionsUniversal_stopStyle(JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return rocksdb::CompactionStopStyleJni::toJavaCompactionStopStyle( opt->stop_style); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: setAllowTrivialMove * Signature: (JZ)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setAllowTrivialMove( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean jallow_trivial_move) { auto* opt = reinterpret_cast(jhandle); opt->allow_trivial_move = static_cast(jallow_trivial_move); } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: allowTrivialMove * Signature: (J)Z */ jboolean Java_org_rocksdb_CompactionOptionsUniversal_allowTrivialMove( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return opt->allow_trivial_move; } /* * Class: org_rocksdb_CompactionOptionsUniversal * Method: disposeInternal * Signature: (J)V */ void Java_org_rocksdb_CompactionOptionsUniversal_disposeInternal( JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { delete reinterpret_cast(jhandle); }