From 2a551976f4b6daa8bdf74f06fdc1bdda7adf5ff8 Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 25 Oct 2022 09:26:51 -0700 Subject: [PATCH] Run format check for *.h and *.cc files under java/ (#10851) Summary: Run format check for .h and .cc files to clean the format Pull Request resolved: https://github.com/facebook/rocksdb/pull/10851 Test Plan: Watch CI tests to pass Reviewed By: ajkr Differential Revision: D40649723 fbshipit-source-id: 62d32cead0b3b8e6540e86d25451bd72642109eb --- java/rocksjni/compact_range_options.cc | 64 +- java/rocksjni/compaction_filter.cc | 3 +- .../compaction_filter_factory_jnicallback.cc | 27 +- .../compaction_filter_factory_jnicallback.h | 16 +- java/rocksjni/compaction_job_info.cc | 54 +- java/rocksjni/compaction_job_stats.cc | 134 +- java/rocksjni/compaction_options.cc | 28 +- java/rocksjni/compaction_options_fifo.cc | 17 +- java/rocksjni/compaction_options_universal.cc | 19 +- java/rocksjni/comparator.cc | 5 +- java/rocksjni/comparatorjnicallback.cc | 284 +- java/rocksjni/comparatorjnicallback.h | 102 +- java/rocksjni/compression_options.cc | 56 +- java/rocksjni/config_options.cc | 3 +- java/rocksjni/env.cc | 56 +- java/rocksjni/env_options.cc | 100 +- java/rocksjni/ingest_external_file_options.cc | 22 +- java/rocksjni/jnicallback.cc | 8 +- java/rocksjni/jnicallback.h | 4 +- java/rocksjni/loggerjnicallback.h | 10 +- java/rocksjni/memory_util.cc | 18 +- java/rocksjni/optimistic_transaction_db.cc | 12 +- java/rocksjni/options.cc | 1435 ++++----- java/rocksjni/options_util.cc | 5 +- java/rocksjni/persistent_cache.cc | 8 +- java/rocksjni/portal.h | 2651 +++++++++-------- java/rocksjni/rocksdb_exception_test.cc | 1 - java/rocksjni/rocksjni.cc | 596 ++-- java/rocksjni/sst_file_reader_iterator.cc | 17 +- java/rocksjni/statistics.cc | 59 +- java/rocksjni/statisticsjni.h | 7 +- java/rocksjni/table.cc | 13 +- java/rocksjni/table_filter_jnicallback.cc | 10 +- java/rocksjni/table_filter_jnicallback.h | 18 +- java/rocksjni/thread_status.cc | 16 +- java/rocksjni/trace_writer.cc | 4 +- java/rocksjni/trace_writer_jnicallback.cc | 45 +- java/rocksjni/trace_writer_jnicallback.h | 16 +- java/rocksjni/transaction.cc | 10 +- java/rocksjni/transaction_db.cc | 25 +- java/rocksjni/transaction_log.cc | 3 +- .../transaction_notifier_jnicallback.cc | 7 +- .../transaction_notifier_jnicallback.h | 4 +- java/rocksjni/ttl.cc | 33 +- java/rocksjni/wal_filter.cc | 4 +- java/rocksjni/wal_filter_jnicallback.cc | 41 +- java/rocksjni/wal_filter_jnicallback.h | 24 +- java/rocksjni/write_batch_test.cc | 3 +- java/rocksjni/write_batch_with_index.cc | 3 +- java/rocksjni/write_buffer_manager.cc | 5 +- java/rocksjni/writebatchhandlerjnicallback.cc | 219 +- java/rocksjni/writebatchhandlerjnicallback.h | 123 +- 52 files changed, 3249 insertions(+), 3198 deletions(-) diff --git a/java/rocksjni/compact_range_options.cc b/java/rocksjni/compact_range_options.cc index d0b91b47a..77fbb8890 100644 --- a/java/rocksjni/compact_range_options.cc +++ b/java/rocksjni/compact_range_options.cc @@ -24,7 +24,6 @@ jlong Java_org_rocksdb_CompactRangeOptions_newCompactRangeOptions( return GET_CPLUSPLUS_POINTER(options); } - /* * Class: org_rocksdb_CompactRangeOptions * Method: exclusiveManualCompaction @@ -43,13 +42,14 @@ jboolean Java_org_rocksdb_CompactRangeOptions_exclusiveManualCompaction( * Signature: (JZ)V */ void Java_org_rocksdb_CompactRangeOptions_setExclusiveManualCompaction( - JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean exclusive_manual_compaction) { + JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, + jboolean exclusive_manual_compaction) { auto* options = reinterpret_cast(jhandle); - options->exclusive_manual_compaction = static_cast(exclusive_manual_compaction); + options->exclusive_manual_compaction = + static_cast(exclusive_manual_compaction); } - /* * Class: org_rocksdb_CompactRangeOptions * Method: bottommostLevelCompaction @@ -83,8 +83,9 @@ void Java_org_rocksdb_CompactRangeOptions_setBottommostLevelCompaction( * Method: changeLevel * Signature: (J)Z */ -jboolean Java_org_rocksdb_CompactRangeOptions_changeLevel - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +jboolean Java_org_rocksdb_CompactRangeOptions_changeLevel(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return static_cast(options->change_level); @@ -95,8 +96,8 @@ jboolean Java_org_rocksdb_CompactRangeOptions_changeLevel * Method: setChangeLevel * Signature: (JZ)V */ -void Java_org_rocksdb_CompactRangeOptions_setChangeLevel - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean change_level) { +void Java_org_rocksdb_CompactRangeOptions_setChangeLevel( + JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean change_level) { auto* options = reinterpret_cast(jhandle); options->change_level = static_cast(change_level); @@ -107,8 +108,9 @@ void Java_org_rocksdb_CompactRangeOptions_setChangeLevel * Method: targetLevel * Signature: (J)I */ -jint Java_org_rocksdb_CompactRangeOptions_targetLevel - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +jint Java_org_rocksdb_CompactRangeOptions_targetLevel(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return static_cast(options->target_level); @@ -119,8 +121,10 @@ jint Java_org_rocksdb_CompactRangeOptions_targetLevel * Method: setTargetLevel * Signature: (JI)V */ -void Java_org_rocksdb_CompactRangeOptions_setTargetLevel - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint target_level) { +void Java_org_rocksdb_CompactRangeOptions_setTargetLevel(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle, + jint target_level) { auto* options = reinterpret_cast(jhandle); options->target_level = static_cast(target_level); @@ -131,8 +135,9 @@ void Java_org_rocksdb_CompactRangeOptions_setTargetLevel * Method: targetPathId * Signature: (J)I */ -jint Java_org_rocksdb_CompactRangeOptions_targetPathId - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +jint Java_org_rocksdb_CompactRangeOptions_targetPathId(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return static_cast(options->target_path_id); @@ -143,8 +148,10 @@ jint Java_org_rocksdb_CompactRangeOptions_targetPathId * Method: setTargetPathId * Signature: (JI)V */ -void Java_org_rocksdb_CompactRangeOptions_setTargetPathId - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint target_path_id) { +void Java_org_rocksdb_CompactRangeOptions_setTargetPathId(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle, + jint target_path_id) { auto* options = reinterpret_cast(jhandle); options->target_path_id = static_cast(target_path_id); @@ -155,8 +162,9 @@ void Java_org_rocksdb_CompactRangeOptions_setTargetPathId * Method: allowWriteStall * Signature: (J)Z */ -jboolean Java_org_rocksdb_CompactRangeOptions_allowWriteStall - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +jboolean Java_org_rocksdb_CompactRangeOptions_allowWriteStall(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return static_cast(options->allow_write_stall); @@ -167,21 +175,22 @@ jboolean Java_org_rocksdb_CompactRangeOptions_allowWriteStall * Method: setAllowWriteStall * Signature: (JZ)V */ -void Java_org_rocksdb_CompactRangeOptions_setAllowWriteStall - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean allow_write_stall) { +void Java_org_rocksdb_CompactRangeOptions_setAllowWriteStall( + JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, + jboolean allow_write_stall) { auto* options = reinterpret_cast(jhandle); options->allow_write_stall = static_cast(allow_write_stall); } - /* * Class: org_rocksdb_CompactRangeOptions * Method: maxSubcompactions * Signature: (J)I */ -jint Java_org_rocksdb_CompactRangeOptions_maxSubcompactions - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +jint Java_org_rocksdb_CompactRangeOptions_maxSubcompactions(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return static_cast(options->max_subcompactions); @@ -192,8 +201,8 @@ jint Java_org_rocksdb_CompactRangeOptions_maxSubcompactions * Method: setMaxSubcompactions * Signature: (JI)V */ -void Java_org_rocksdb_CompactRangeOptions_setMaxSubcompactions - (JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint max_subcompactions) { +void Java_org_rocksdb_CompactRangeOptions_setMaxSubcompactions( + JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jint max_subcompactions) { auto* options = reinterpret_cast(jhandle); options->max_subcompactions = static_cast(max_subcompactions); @@ -204,8 +213,9 @@ void Java_org_rocksdb_CompactRangeOptions_setMaxSubcompactions * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_CompactRangeOptions_disposeInternal( - JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +void Java_org_rocksdb_CompactRangeOptions_disposeInternal(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); delete options; diff --git a/java/rocksjni/compaction_filter.cc b/java/rocksjni/compaction_filter.cc index c3a68cdf2..ea04996ac 100644 --- a/java/rocksjni/compaction_filter.cc +++ b/java/rocksjni/compaction_filter.cc @@ -6,10 +6,11 @@ // This file implements the "bridge" between Java and C++ for // ROCKSDB_NAMESPACE::CompactionFilter. +#include "rocksdb/compaction_filter.h" + #include #include "include/org_rocksdb_AbstractCompactionFilter.h" -#include "rocksdb/compaction_filter.h" // diff --git a/java/rocksjni/compaction_filter_factory_jnicallback.cc b/java/rocksjni/compaction_filter_factory_jnicallback.cc index cacbf02c1..14285526f 100644 --- a/java/rocksjni/compaction_filter_factory_jnicallback.cc +++ b/java/rocksjni/compaction_filter_factory_jnicallback.cc @@ -7,38 +7,40 @@ // ROCKSDB_NAMESPACE::CompactionFilterFactory. #include "rocksjni/compaction_filter_factory_jnicallback.h" + #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { CompactionFilterFactoryJniCallback::CompactionFilterFactoryJniCallback( JNIEnv* env, jobject jcompaction_filter_factory) : JniCallback(env, jcompaction_filter_factory) { - // Note: The name of a CompactionFilterFactory will not change during // it's lifetime, so we cache it in a global var jmethodID jname_method_id = AbstractCompactionFilterFactoryJni::getNameMethodId(env); - if(jname_method_id == nullptr) { + if (jname_method_id == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } jstring jname = (jstring)env->CallObjectMethod(m_jcallback_obj, jname_method_id); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown return; } jboolean has_exception = JNI_FALSE; - m_name = JniUtil::copyString(env, jname, &has_exception); // also releases jname + m_name = + JniUtil::copyString(env, jname, &has_exception); // also releases jname if (has_exception == JNI_TRUE) { // exception thrown return; } m_jcreate_compaction_filter_methodid = - AbstractCompactionFilterFactoryJni::getCreateCompactionFilterMethodId(env); - if(m_jcreate_compaction_filter_methodid == nullptr) { + AbstractCompactionFilterFactoryJni::getCreateCompactionFilterMethodId( + env); + if (m_jcreate_compaction_filter_methodid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } @@ -48,18 +50,19 @@ const char* CompactionFilterFactoryJniCallback::Name() const { return m_name.get(); } -std::unique_ptr CompactionFilterFactoryJniCallback::CreateCompactionFilter( +std::unique_ptr +CompactionFilterFactoryJniCallback::CreateCompactionFilter( const CompactionFilter::Context& context) { jboolean attached_thread = JNI_FALSE; JNIEnv* env = getJniEnv(&attached_thread); assert(env != nullptr); - jlong addr_compaction_filter = env->CallLongMethod(m_jcallback_obj, - m_jcreate_compaction_filter_methodid, - static_cast(context.is_full_compaction), - static_cast(context.is_manual_compaction)); + jlong addr_compaction_filter = + env->CallLongMethod(m_jcallback_obj, m_jcreate_compaction_filter_methodid, + static_cast(context.is_full_compaction), + static_cast(context.is_manual_compaction)); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown from CallLongMethod env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); diff --git a/java/rocksjni/compaction_filter_factory_jnicallback.h b/java/rocksjni/compaction_filter_factory_jnicallback.h index eb2d5111d..2f26f8dbe 100644 --- a/java/rocksjni/compaction_filter_factory_jnicallback.h +++ b/java/rocksjni/compaction_filter_factory_jnicallback.h @@ -10,6 +10,7 @@ #define JAVA_ROCKSJNI_COMPACTION_FILTER_FACTORY_JNICALLBACK_H_ #include + #include #include "rocksdb/compaction_filter.h" @@ -17,17 +18,18 @@ namespace ROCKSDB_NAMESPACE { -class CompactionFilterFactoryJniCallback : public JniCallback, public CompactionFilterFactory { +class CompactionFilterFactoryJniCallback : public JniCallback, + public CompactionFilterFactory { public: - CompactionFilterFactoryJniCallback( - JNIEnv* env, jobject jcompaction_filter_factory); - virtual std::unique_ptr CreateCompactionFilter( + CompactionFilterFactoryJniCallback(JNIEnv* env, + jobject jcompaction_filter_factory); + virtual std::unique_ptr CreateCompactionFilter( const CompactionFilter::Context& context); - virtual const char* Name() const; + virtual const char* Name() const; private: - std::unique_ptr m_name; - jmethodID m_jcreate_compaction_filter_methodid; + std::unique_ptr m_name; + jmethodID m_jcreate_compaction_filter_methodid; }; } // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/compaction_job_info.cc b/java/rocksjni/compaction_job_info.cc index de65478b6..fb292f59c 100644 --- a/java/rocksjni/compaction_job_info.cc +++ b/java/rocksjni/compaction_job_info.cc @@ -18,8 +18,7 @@ * Method: newCompactionJobInfo * Signature: ()J */ -jlong Java_org_rocksdb_CompactionJobInfo_newCompactionJobInfo( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_CompactionJobInfo_newCompactionJobInfo(JNIEnv*, jclass) { auto* compact_job_info = new ROCKSDB_NAMESPACE::CompactionJobInfo(); return GET_CPLUSPLUS_POINTER(compact_job_info); } @@ -29,8 +28,8 @@ jlong Java_org_rocksdb_CompactionJobInfo_newCompactionJobInfo( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_CompactionJobInfo_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_CompactionJobInfo_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); delete compact_job_info; @@ -41,8 +40,9 @@ void Java_org_rocksdb_CompactionJobInfo_disposeInternal( * Method: columnFamilyName * Signature: (J)[B */ -jbyteArray Java_org_rocksdb_CompactionJobInfo_columnFamilyName( - JNIEnv* env, jclass, jlong jhandle) { +jbyteArray Java_org_rocksdb_CompactionJobInfo_columnFamilyName(JNIEnv* env, + jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::JniUtil::copyBytes(env, compact_job_info->cf_name); @@ -53,8 +53,8 @@ jbyteArray Java_org_rocksdb_CompactionJobInfo_columnFamilyName( * Method: status * Signature: (J)Lorg/rocksdb/Status; */ -jobject Java_org_rocksdb_CompactionJobInfo_status( - JNIEnv* env, jclass, jlong jhandle) { +jobject Java_org_rocksdb_CompactionJobInfo_status(JNIEnv* env, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::StatusJni::construct(env, compact_job_info->status); @@ -65,8 +65,8 @@ jobject Java_org_rocksdb_CompactionJobInfo_status( * Method: threadId * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobInfo_threadId( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobInfo_threadId(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return static_cast(compact_job_info->thread_id); @@ -77,8 +77,7 @@ jlong Java_org_rocksdb_CompactionJobInfo_threadId( * Method: jobId * Signature: (J)I */ -jint Java_org_rocksdb_CompactionJobInfo_jobId( - JNIEnv*, jclass, jlong jhandle) { +jint Java_org_rocksdb_CompactionJobInfo_jobId(JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return static_cast(compact_job_info->job_id); @@ -89,8 +88,8 @@ jint Java_org_rocksdb_CompactionJobInfo_jobId( * Method: baseInputLevel * Signature: (J)I */ -jint Java_org_rocksdb_CompactionJobInfo_baseInputLevel( - JNIEnv*, jclass, jlong jhandle) { +jint Java_org_rocksdb_CompactionJobInfo_baseInputLevel(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return static_cast(compact_job_info->base_input_level); @@ -101,8 +100,8 @@ jint Java_org_rocksdb_CompactionJobInfo_baseInputLevel( * Method: outputLevel * Signature: (J)I */ -jint Java_org_rocksdb_CompactionJobInfo_outputLevel( - JNIEnv*, jclass, jlong jhandle) { +jint Java_org_rocksdb_CompactionJobInfo_outputLevel(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return static_cast(compact_job_info->output_level); @@ -113,8 +112,8 @@ jint Java_org_rocksdb_CompactionJobInfo_outputLevel( * Method: inputFiles * Signature: (J)[Ljava/lang/String; */ -jobjectArray Java_org_rocksdb_CompactionJobInfo_inputFiles( - JNIEnv* env, jclass, jlong jhandle) { +jobjectArray Java_org_rocksdb_CompactionJobInfo_inputFiles(JNIEnv* env, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::JniUtil::toJavaStrings( @@ -126,8 +125,8 @@ jobjectArray Java_org_rocksdb_CompactionJobInfo_inputFiles( * Method: outputFiles * Signature: (J)[Ljava/lang/String; */ -jobjectArray Java_org_rocksdb_CompactionJobInfo_outputFiles( - JNIEnv* env, jclass, jlong jhandle) { +jobjectArray Java_org_rocksdb_CompactionJobInfo_outputFiles(JNIEnv* env, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::JniUtil::toJavaStrings( @@ -139,8 +138,8 @@ jobjectArray Java_org_rocksdb_CompactionJobInfo_outputFiles( * Method: tableProperties * Signature: (J)Ljava/util/Map; */ -jobject Java_org_rocksdb_CompactionJobInfo_tableProperties( - JNIEnv* env, jclass, jlong jhandle) { +jobject Java_org_rocksdb_CompactionJobInfo_tableProperties(JNIEnv* env, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); auto* map = &compact_job_info->table_properties; @@ -196,8 +195,8 @@ jobject Java_org_rocksdb_CompactionJobInfo_tableProperties( * Method: compactionReason * Signature: (J)B */ -jbyte Java_org_rocksdb_CompactionJobInfo_compactionReason( - JNIEnv*, jclass, jlong jhandle) { +jbyte Java_org_rocksdb_CompactionJobInfo_compactionReason(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompactionReasonJni::toJavaCompactionReason( @@ -209,8 +208,8 @@ jbyte Java_org_rocksdb_CompactionJobInfo_compactionReason( * Method: compression * Signature: (J)B */ -jbyte Java_org_rocksdb_CompactionJobInfo_compression( - JNIEnv*, jclass, jlong jhandle) { +jbyte Java_org_rocksdb_CompactionJobInfo_compression(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( @@ -222,8 +221,7 @@ jbyte Java_org_rocksdb_CompactionJobInfo_compression( * Method: stats * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobInfo_stats( - JNIEnv *, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobInfo_stats(JNIEnv*, jclass, jlong jhandle) { auto* compact_job_info = reinterpret_cast(jhandle); auto* stats = new ROCKSDB_NAMESPACE::CompactionJobStats(); diff --git a/java/rocksjni/compaction_job_stats.cc b/java/rocksjni/compaction_job_stats.cc index a9bd9499e..a2599c132 100644 --- a/java/rocksjni/compaction_job_stats.cc +++ b/java/rocksjni/compaction_job_stats.cc @@ -19,8 +19,8 @@ * Method: newCompactionJobStats * Signature: ()J */ -jlong Java_org_rocksdb_CompactionJobStats_newCompactionJobStats( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_CompactionJobStats_newCompactionJobStats(JNIEnv*, + jclass) { auto* compact_job_stats = new ROCKSDB_NAMESPACE::CompactionJobStats(); return GET_CPLUSPLUS_POINTER(compact_job_stats); } @@ -30,8 +30,8 @@ jlong Java_org_rocksdb_CompactionJobStats_newCompactionJobStats( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_CompactionJobStats_disposeInternal( - JNIEnv *, jobject, jlong jhandle) { +void Java_org_rocksdb_CompactionJobStats_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); delete compact_job_stats; @@ -42,8 +42,7 @@ void Java_org_rocksdb_CompactionJobStats_disposeInternal( * Method: reset * Signature: (J)V */ -void Java_org_rocksdb_CompactionJobStats_reset( - JNIEnv*, jclass, jlong jhandle) { +void Java_org_rocksdb_CompactionJobStats_reset(JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); compact_job_stats->Reset(); @@ -54,8 +53,8 @@ void Java_org_rocksdb_CompactionJobStats_reset( * Method: add * Signature: (JJ)V */ -void Java_org_rocksdb_CompactionJobStats_add( - JNIEnv*, jclass, jlong jhandle, jlong jother_handle) { +void Java_org_rocksdb_CompactionJobStats_add(JNIEnv*, jclass, jlong jhandle, + jlong jother_handle) { auto* compact_job_stats = reinterpret_cast(jhandle); auto* other_compact_job_stats = @@ -68,8 +67,8 @@ void Java_org_rocksdb_CompactionJobStats_add( * Method: elapsedMicros * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_elapsedMicros( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_elapsedMicros(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); return static_cast(compact_job_stats->elapsed_micros); @@ -80,8 +79,8 @@ jlong Java_org_rocksdb_CompactionJobStats_elapsedMicros( * Method: numInputRecords * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numInputRecords( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numInputRecords(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); return static_cast(compact_job_stats->num_input_records); @@ -92,8 +91,8 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputRecords( * Method: numInputFiles * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numInputFiles( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numInputFiles(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); return static_cast(compact_job_stats->num_input_files); @@ -108,8 +107,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputFilesAtOutputLevel( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_input_files_at_output_level); + return static_cast(compact_job_stats->num_input_files_at_output_level); } /* @@ -117,12 +115,11 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputFilesAtOutputLevel( * Method: numOutputRecords * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numOutputRecords( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numOutputRecords(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_output_records); + return static_cast(compact_job_stats->num_output_records); } /* @@ -130,12 +127,11 @@ jlong Java_org_rocksdb_CompactionJobStats_numOutputRecords( * Method: numOutputFiles * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numOutputFiles( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numOutputFiles(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_output_files); + return static_cast(compact_job_stats->num_output_files); } /* @@ -143,8 +139,8 @@ jlong Java_org_rocksdb_CompactionJobStats_numOutputFiles( * Method: isManualCompaction * Signature: (J)Z */ -jboolean Java_org_rocksdb_CompactionJobStats_isManualCompaction( - JNIEnv*, jclass, jlong jhandle) { +jboolean Java_org_rocksdb_CompactionJobStats_isManualCompaction(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); if (compact_job_stats->is_manual_compaction) { @@ -159,12 +155,11 @@ jboolean Java_org_rocksdb_CompactionJobStats_isManualCompaction( * Method: totalInputBytes * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_totalInputBytes( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_totalInputBytes(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->total_input_bytes); + return static_cast(compact_job_stats->total_input_bytes); } /* @@ -172,12 +167,11 @@ jlong Java_org_rocksdb_CompactionJobStats_totalInputBytes( * Method: totalOutputBytes * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_totalOutputBytes( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_totalOutputBytes(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->total_output_bytes); + return static_cast(compact_job_stats->total_output_bytes); } /* @@ -185,12 +179,11 @@ jlong Java_org_rocksdb_CompactionJobStats_totalOutputBytes( * Method: numRecordsReplaced * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numRecordsReplaced( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numRecordsReplaced(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_records_replaced); + return static_cast(compact_job_stats->num_records_replaced); } /* @@ -198,12 +191,11 @@ jlong Java_org_rocksdb_CompactionJobStats_numRecordsReplaced( * Method: totalInputRawKeyBytes * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_totalInputRawKeyBytes( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_totalInputRawKeyBytes(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->total_input_raw_key_bytes); + return static_cast(compact_job_stats->total_input_raw_key_bytes); } /* @@ -215,8 +207,7 @@ jlong Java_org_rocksdb_CompactionJobStats_totalInputRawValueBytes( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->total_input_raw_value_bytes); + return static_cast(compact_job_stats->total_input_raw_value_bytes); } /* @@ -228,8 +219,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numInputDeletionRecords( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_input_deletion_records); + return static_cast(compact_job_stats->num_input_deletion_records); } /* @@ -241,8 +231,7 @@ jlong Java_org_rocksdb_CompactionJobStats_numExpiredDeletionRecords( JNIEnv*, jclass, jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_expired_deletion_records); + return static_cast(compact_job_stats->num_expired_deletion_records); } /* @@ -250,12 +239,11 @@ jlong Java_org_rocksdb_CompactionJobStats_numExpiredDeletionRecords( * Method: numCorruptKeys * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numCorruptKeys( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numCorruptKeys(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_corrupt_keys); + return static_cast(compact_job_stats->num_corrupt_keys); } /* @@ -263,12 +251,11 @@ jlong Java_org_rocksdb_CompactionJobStats_numCorruptKeys( * Method: fileWriteNanos * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_fileWriteNanos( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_fileWriteNanos(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->file_write_nanos); + return static_cast(compact_job_stats->file_write_nanos); } /* @@ -276,12 +263,11 @@ jlong Java_org_rocksdb_CompactionJobStats_fileWriteNanos( * Method: fileRangeSyncNanos * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_fileRangeSyncNanos( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_fileRangeSyncNanos(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->file_range_sync_nanos); + return static_cast(compact_job_stats->file_range_sync_nanos); } /* @@ -289,12 +275,11 @@ jlong Java_org_rocksdb_CompactionJobStats_fileRangeSyncNanos( * Method: fileFsyncNanos * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_fileFsyncNanos( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_fileFsyncNanos(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->file_fsync_nanos); + return static_cast(compact_job_stats->file_fsync_nanos); } /* @@ -302,12 +287,11 @@ jlong Java_org_rocksdb_CompactionJobStats_fileFsyncNanos( * Method: filePrepareWriteNanos * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_filePrepareWriteNanos( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_filePrepareWriteNanos(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->file_prepare_write_nanos); + return static_cast(compact_job_stats->file_prepare_write_nanos); } /* @@ -341,12 +325,11 @@ jbyteArray Java_org_rocksdb_CompactionJobStats_largestOutputKeyPrefix( * Method: numSingleDelFallthru * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numSingleDelFallthru( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numSingleDelFallthru(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_single_del_fallthru); + return static_cast(compact_job_stats->num_single_del_fallthru); } /* @@ -354,10 +337,9 @@ jlong Java_org_rocksdb_CompactionJobStats_numSingleDelFallthru( * Method: numSingleDelMismatch * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionJobStats_numSingleDelMismatch( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionJobStats_numSingleDelMismatch(JNIEnv*, jclass, + jlong jhandle) { auto* compact_job_stats = reinterpret_cast(jhandle); - return static_cast( - compact_job_stats->num_single_del_mismatch); + return static_cast(compact_job_stats->num_single_del_mismatch); } diff --git a/java/rocksjni/compaction_options.cc b/java/rocksjni/compaction_options.cc index f5ddcd6d4..bbbde0313 100644 --- a/java/rocksjni/compaction_options.cc +++ b/java/rocksjni/compaction_options.cc @@ -18,8 +18,7 @@ * Method: newCompactionOptions * Signature: ()J */ -jlong Java_org_rocksdb_CompactionOptions_newCompactionOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_CompactionOptions_newCompactionOptions(JNIEnv*, jclass) { auto* compact_opts = new ROCKSDB_NAMESPACE::CompactionOptions(); return GET_CPLUSPLUS_POINTER(compact_opts); } @@ -29,8 +28,8 @@ jlong Java_org_rocksdb_CompactionOptions_newCompactionOptions( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_CompactionOptions_disposeInternal( - JNIEnv *, jobject, jlong jhandle) { +void Java_org_rocksdb_CompactionOptions_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* compact_opts = reinterpret_cast(jhandle); delete compact_opts; @@ -41,8 +40,8 @@ void Java_org_rocksdb_CompactionOptions_disposeInternal( * Method: compression * Signature: (J)B */ -jbyte Java_org_rocksdb_CompactionOptions_compression( - JNIEnv*, jclass, jlong jhandle) { +jbyte Java_org_rocksdb_CompactionOptions_compression(JNIEnv*, jclass, + jlong jhandle) { auto* compact_opts = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( @@ -68,12 +67,11 @@ void Java_org_rocksdb_CompactionOptions_setCompression( * Method: outputFileSizeLimit * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionOptions_outputFileSizeLimit( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_CompactionOptions_outputFileSizeLimit(JNIEnv*, jclass, + jlong jhandle) { auto* compact_opts = reinterpret_cast(jhandle); - return static_cast( - compact_opts->output_file_size_limit); + return static_cast(compact_opts->output_file_size_limit); } /* @@ -94,12 +92,11 @@ void Java_org_rocksdb_CompactionOptions_setOutputFileSizeLimit( * Method: maxSubcompactions * Signature: (J)I */ -jint Java_org_rocksdb_CompactionOptions_maxSubcompactions( - JNIEnv*, jclass, jlong jhandle) { +jint Java_org_rocksdb_CompactionOptions_maxSubcompactions(JNIEnv*, jclass, + jlong jhandle) { auto* compact_opts = reinterpret_cast(jhandle); - return static_cast( - compact_opts->max_subcompactions); + return static_cast(compact_opts->max_subcompactions); } /* @@ -111,6 +108,5 @@ void Java_org_rocksdb_CompactionOptions_setMaxSubcompactions( JNIEnv*, jclass, jlong jhandle, jint jmax_subcompactions) { auto* compact_opts = reinterpret_cast(jhandle); - compact_opts->max_subcompactions = - static_cast(jmax_subcompactions); + compact_opts->max_subcompactions = static_cast(jmax_subcompactions); } diff --git a/java/rocksjni/compaction_options_fifo.cc b/java/rocksjni/compaction_options_fifo.cc index 36f99749b..f6a47fec5 100644 --- a/java/rocksjni/compaction_options_fifo.cc +++ b/java/rocksjni/compaction_options_fifo.cc @@ -17,8 +17,8 @@ * Method: newCompactionOptionsFIFO * Signature: ()J */ -jlong Java_org_rocksdb_CompactionOptionsFIFO_newCompactionOptionsFIFO( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_CompactionOptionsFIFO_newCompactionOptionsFIFO(JNIEnv*, + jclass) { const auto* opt = new ROCKSDB_NAMESPACE::CompactionOptionsFIFO(); return GET_CPLUSPLUS_POINTER(opt); } @@ -40,8 +40,8 @@ void Java_org_rocksdb_CompactionOptionsFIFO_setMaxTableFilesSize( * Method: maxTableFilesSize * Signature: (J)J */ -jlong Java_org_rocksdb_CompactionOptionsFIFO_maxTableFilesSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_CompactionOptionsFIFO_maxTableFilesSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_table_files_size); @@ -64,8 +64,9 @@ void Java_org_rocksdb_CompactionOptionsFIFO_setAllowCompaction( * Method: allowCompaction * Signature: (J)Z */ -jboolean Java_org_rocksdb_CompactionOptionsFIFO_allowCompaction( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_CompactionOptionsFIFO_allowCompaction(JNIEnv*, + jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_compaction); @@ -76,7 +77,7 @@ jboolean Java_org_rocksdb_CompactionOptionsFIFO_allowCompaction( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_CompactionOptionsFIFO_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_CompactionOptionsFIFO_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/compaction_options_universal.cc b/java/rocksjni/compaction_options_universal.cc index c3a1401e6..9fc6f3158 100644 --- a/java/rocksjni/compaction_options_universal.cc +++ b/java/rocksjni/compaction_options_universal.cc @@ -41,8 +41,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setSizeRatio( * Method: sizeRatio * Signature: (J)I */ -jint Java_org_rocksdb_CompactionOptionsUniversal_sizeRatio( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompactionOptionsUniversal_sizeRatio(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->size_ratio); @@ -65,8 +65,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setMinMergeWidth( * Method: minMergeWidth * Signature: (J)I */ -jint Java_org_rocksdb_CompactionOptionsUniversal_minMergeWidth( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompactionOptionsUniversal_minMergeWidth(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->min_merge_width); @@ -89,8 +89,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setMaxMergeWidth( * Method: maxMergeWidth * Signature: (J)I */ -jint Java_org_rocksdb_CompactionOptionsUniversal_maxMergeWidth( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompactionOptionsUniversal_maxMergeWidth(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_merge_width); @@ -127,8 +127,7 @@ jint Java_org_rocksdb_CompactionOptionsUniversal_maxSizeAmplificationPercent( * Signature: (JI)V */ void Java_org_rocksdb_CompactionOptionsUniversal_setCompressionSizePercent( - JNIEnv*, jobject, jlong jhandle, - jint jcompression_size_percent) { + JNIEnv*, jobject, jlong jhandle, jint jcompression_size_percent) { auto* opt = reinterpret_cast(jhandle); opt->compression_size_percent = @@ -166,8 +165,8 @@ void Java_org_rocksdb_CompactionOptionsUniversal_setStopStyle( * Method: stopStyle * Signature: (J)B */ -jbyte Java_org_rocksdb_CompactionOptionsUniversal_stopStyle( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_CompactionOptionsUniversal_stopStyle(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompactionStopStyleJni::toJavaCompactionStopStyle( diff --git a/java/rocksjni/comparator.cc b/java/rocksjni/comparator.cc index 4bf53a446..11279c4ce 100644 --- a/java/rocksjni/comparator.cc +++ b/java/rocksjni/comparator.cc @@ -39,8 +39,9 @@ jlong Java_org_rocksdb_AbstractComparator_createNewComparator( * Method: usingDirectBuffers * Signature: (J)Z */ -jboolean Java_org_rocksdb_AbstractComparator_usingDirectBuffers( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_AbstractComparator_usingDirectBuffers(JNIEnv*, + jobject, + jlong jhandle) { auto* c = reinterpret_cast(jhandle); return static_cast(c->m_options->direct_buffer); diff --git a/java/rocksjni/comparatorjnicallback.cc b/java/rocksjni/comparatorjnicallback.cc index 248b15d3a..07ab9fa41 100644 --- a/java/rocksjni/comparatorjnicallback.cc +++ b/java/rocksjni/comparatorjnicallback.cc @@ -7,18 +7,18 @@ // ROCKSDB_NAMESPACE::Comparator. #include "rocksjni/comparatorjnicallback.h" + #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { ComparatorJniCallback::ComparatorJniCallback( JNIEnv* env, jobject jcomparator, const ComparatorJniCallbackOptions* options) - : JniCallback(env, jcomparator), - m_options(options) { - - // cache the AbstractComparatorJniBridge class as we will reuse it many times for each callback - m_abstract_comparator_jni_bridge_clazz = - static_cast(env->NewGlobalRef(AbstractComparatorJniBridge::getJClass(env))); + : JniCallback(env, jcomparator), m_options(options) { + // cache the AbstractComparatorJniBridge class as we will reuse it many times + // for each callback + m_abstract_comparator_jni_bridge_clazz = static_cast( + env->NewGlobalRef(AbstractComparatorJniBridge::getJClass(env))); // Note: The name of a Comparator will not change during it's lifetime, // so we cache it in a global var @@ -34,7 +34,7 @@ ComparatorJniCallback::ComparatorJniCallback( } jboolean has_exception = JNI_FALSE; m_name = JniUtil::copyString(env, js_name, - &has_exception); // also releases jsName + &has_exception); // also releases jsName if (has_exception == JNI_TRUE) { // exception thrown return; @@ -52,16 +52,16 @@ ComparatorJniCallback::ComparatorJniCallback( } m_jshortest_mid = - AbstractComparatorJniBridge::getFindShortestSeparatorInternalMethodId( - env, m_abstract_comparator_jni_bridge_clazz); + AbstractComparatorJniBridge::getFindShortestSeparatorInternalMethodId( + env, m_abstract_comparator_jni_bridge_clazz); if (m_jshortest_mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } m_jshort_mid = - AbstractComparatorJniBridge::getFindShortSuccessorInternalMethodId(env, - m_abstract_comparator_jni_bridge_clazz); + AbstractComparatorJniBridge::getFindShortSuccessorInternalMethodId( + env, m_abstract_comparator_jni_bridge_clazz); if (m_jshort_mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; @@ -69,9 +69,8 @@ ComparatorJniCallback::ComparatorJniCallback( // do we need reusable buffers? if (m_options->max_reused_buffer_size > -1) { - - if (m_options->reused_synchronisation_type - == ReusedSynchronisationType::THREAD_LOCAL) { + if (m_options->reused_synchronisation_type == + ReusedSynchronisationType::THREAD_LOCAL) { // buffers reused per thread UnrefHandler unref = [](void* ptr) { ThreadLocalBuf* tlb = reinterpret_cast(ptr); @@ -97,9 +96,9 @@ ComparatorJniCallback::ComparatorJniCallback( m_jshort_buf_key = nullptr; } else { - //buffers reused and shared across threads - const bool adaptive = - m_options->reused_synchronisation_type == ReusedSynchronisationType::ADAPTIVE_MUTEX; + // buffers reused and shared across threads + const bool adaptive = m_options->reused_synchronisation_type == + ReusedSynchronisationType::ADAPTIVE_MUTEX; mtx_compare = std::unique_ptr(new port::Mutex(adaptive)); mtx_shortest = std::unique_ptr(new port::Mutex(adaptive)); mtx_short = std::unique_ptr(new port::Mutex(adaptive)); @@ -220,9 +219,7 @@ ComparatorJniCallback::~ComparatorJniCallback() { releaseJniEnv(attached_thread); } -const char* ComparatorJniCallback::Name() const { - return m_name.get(); -} +const char* ComparatorJniCallback::Name() const { return m_name.get(); } int ComparatorJniCallback::Compare(const Slice& a, const Slice& b) const { jboolean attached_thread = JNI_FALSE; @@ -236,38 +233,38 @@ int ComparatorJniCallback::Compare(const Slice& a, const Slice& b) const { MaybeLockForReuse(mtx_compare, reuse_jbuf_a || reuse_jbuf_b); - jobject jcompare_buf_a = GetBuffer(env, a, reuse_jbuf_a, m_tl_buf_a, m_jcompare_buf_a); + jobject jcompare_buf_a = + GetBuffer(env, a, reuse_jbuf_a, m_tl_buf_a, m_jcompare_buf_a); if (jcompare_buf_a == nullptr) { // exception occurred MaybeUnlockForReuse(mtx_compare, reuse_jbuf_a || reuse_jbuf_b); - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return 0; } - jobject jcompare_buf_b = GetBuffer(env, b, reuse_jbuf_b, m_tl_buf_b, m_jcompare_buf_b); + jobject jcompare_buf_b = + GetBuffer(env, b, reuse_jbuf_b, m_tl_buf_b, m_jcompare_buf_b); if (jcompare_buf_b == nullptr) { // exception occurred if (!reuse_jbuf_a) { DeleteBuffer(env, jcompare_buf_a); } MaybeUnlockForReuse(mtx_compare, reuse_jbuf_a || reuse_jbuf_b); - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return 0; } - jint result = - env->CallStaticIntMethod( - m_abstract_comparator_jni_bridge_clazz, m_jcompare_mid, - m_jcallback_obj, - jcompare_buf_a, reuse_jbuf_a ? a.size() : -1, - jcompare_buf_b, reuse_jbuf_b ? b.size() : -1); + jint result = env->CallStaticIntMethod( + m_abstract_comparator_jni_bridge_clazz, m_jcompare_mid, m_jcallback_obj, + jcompare_buf_a, reuse_jbuf_a ? a.size() : -1, jcompare_buf_b, + reuse_jbuf_b ? b.size() : -1); if (env->ExceptionCheck()) { // exception thrown from CallIntMethod - env->ExceptionDescribe(); // print out exception to stderr - result = 0; // we could not get a result from java callback so use 0 + env->ExceptionDescribe(); // print out exception to stderr + result = 0; // we could not get a result from java callback so use 0 } if (!reuse_jbuf_a) { @@ -284,8 +281,8 @@ int ComparatorJniCallback::Compare(const Slice& a, const Slice& b) const { return result; } -void ComparatorJniCallback::FindShortestSeparator( - std::string* start, const Slice& limit) const { +void ComparatorJniCallback::FindShortestSeparator(std::string* start, + const Slice& limit) const { if (start == nullptr) { return; } @@ -294,88 +291,90 @@ void ComparatorJniCallback::FindShortestSeparator( JNIEnv* env = getJniEnv(&attached_thread); assert(env != nullptr); - const bool reuse_jbuf_start = - static_cast(start->length()) <= m_options->max_reused_buffer_size; + const bool reuse_jbuf_start = static_cast(start->length()) <= + m_options->max_reused_buffer_size; const bool reuse_jbuf_limit = static_cast(limit.size()) <= m_options->max_reused_buffer_size; MaybeLockForReuse(mtx_shortest, reuse_jbuf_start || reuse_jbuf_limit); Slice sstart(start->data(), start->length()); - jobject j_start_buf = GetBuffer(env, sstart, reuse_jbuf_start, m_tl_buf_a, m_jshortest_buf_start); + jobject j_start_buf = GetBuffer(env, sstart, reuse_jbuf_start, m_tl_buf_a, + m_jshortest_buf_start); if (j_start_buf == nullptr) { // exception occurred MaybeUnlockForReuse(mtx_shortest, reuse_jbuf_start || reuse_jbuf_limit); - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return; } - jobject j_limit_buf = GetBuffer(env, limit, reuse_jbuf_limit, m_tl_buf_b, m_jshortest_buf_limit); + jobject j_limit_buf = GetBuffer(env, limit, reuse_jbuf_limit, m_tl_buf_b, + m_jshortest_buf_limit); if (j_limit_buf == nullptr) { // exception occurred if (!reuse_jbuf_start) { DeleteBuffer(env, j_start_buf); } MaybeUnlockForReuse(mtx_shortest, reuse_jbuf_start || reuse_jbuf_limit); - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return; } jint jstart_len = env->CallStaticIntMethod( - m_abstract_comparator_jni_bridge_clazz, m_jshortest_mid, - m_jcallback_obj, - j_start_buf, reuse_jbuf_start ? start->length() : -1, - j_limit_buf, reuse_jbuf_limit ? limit.size() : -1); + m_abstract_comparator_jni_bridge_clazz, m_jshortest_mid, m_jcallback_obj, + j_start_buf, reuse_jbuf_start ? start->length() : -1, j_limit_buf, + reuse_jbuf_limit ? limit.size() : -1); if (env->ExceptionCheck()) { // exception thrown from CallIntMethod - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr } else if (static_cast(jstart_len) != start->length()) { // start buffer has changed in Java, so update `start` with the result bool copy_from_non_direct = false; if (reuse_jbuf_start) { - // reused a buffer - if (m_options->direct_buffer) { - // reused direct buffer - void* start_buf = env->GetDirectBufferAddress(j_start_buf); - if (start_buf == nullptr) { - if (!reuse_jbuf_start) { - DeleteBuffer(env, j_start_buf); - } - if (!reuse_jbuf_limit) { - DeleteBuffer(env, j_limit_buf); - } - MaybeUnlockForReuse(mtx_shortest, reuse_jbuf_start || reuse_jbuf_limit); - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Unable to get Direct Buffer Address"); - env->ExceptionDescribe(); // print out exception to stderr - releaseJniEnv(attached_thread); - return; + // reused a buffer + if (m_options->direct_buffer) { + // reused direct buffer + void* start_buf = env->GetDirectBufferAddress(j_start_buf); + if (start_buf == nullptr) { + if (!reuse_jbuf_start) { + DeleteBuffer(env, j_start_buf); } - start->assign(static_cast(start_buf), jstart_len); - - } else { - - // reused non-direct buffer - copy_from_non_direct = true; + if (!reuse_jbuf_limit) { + DeleteBuffer(env, j_limit_buf); + } + MaybeUnlockForReuse(mtx_shortest, + reuse_jbuf_start || reuse_jbuf_limit); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Unable to get Direct Buffer Address"); + env->ExceptionDescribe(); // print out exception to stderr + releaseJniEnv(attached_thread); + return; } + start->assign(static_cast(start_buf), jstart_len); + + } else { + // reused non-direct buffer + copy_from_non_direct = true; + } } else { - // there was a new buffer - if (m_options->direct_buffer) { - // it was direct... don't forget to potentially truncate the `start` string - start->resize(jstart_len); - } else { - // it was non-direct - copy_from_non_direct = true; - } + // there was a new buffer + if (m_options->direct_buffer) { + // it was direct... don't forget to potentially truncate the `start` + // string + start->resize(jstart_len); + } else { + // it was non-direct + copy_from_non_direct = true; + } } if (copy_from_non_direct) { - jbyteArray jarray = ByteBufferJni::array(env, j_start_buf, - m_jbytebuffer_clazz); + jbyteArray jarray = + ByteBufferJni::array(env, j_start_buf, m_jbytebuffer_clazz); if (jarray == nullptr) { if (!reuse_jbuf_start) { DeleteBuffer(env, j_start_buf); @@ -389,9 +388,12 @@ void ComparatorJniCallback::FindShortestSeparator( return; } jboolean has_exception = JNI_FALSE; - JniUtil::byteString(env, jarray, [start, jstart_len](const char* data, const size_t) { - return start->assign(data, static_cast(jstart_len)); - }, &has_exception); + JniUtil::byteString( + env, jarray, + [start, jstart_len](const char* data, const size_t) { + return start->assign(data, static_cast(jstart_len)); + }, + &has_exception); env->DeleteLocalRef(jarray); if (has_exception == JNI_TRUE) { if (!reuse_jbuf_start) { @@ -420,8 +422,7 @@ void ComparatorJniCallback::FindShortestSeparator( releaseJniEnv(attached_thread); } -void ComparatorJniCallback::FindShortSuccessor( - std::string* key) const { +void ComparatorJniCallback::FindShortSuccessor(std::string* key) const { if (key == nullptr) { return; } @@ -436,18 +437,18 @@ void ComparatorJniCallback::FindShortSuccessor( MaybeLockForReuse(mtx_short, reuse_jbuf_key); Slice skey(key->data(), key->length()); - jobject j_key_buf = GetBuffer(env, skey, reuse_jbuf_key, m_tl_buf_a, m_jshort_buf_key); + jobject j_key_buf = + GetBuffer(env, skey, reuse_jbuf_key, m_tl_buf_a, m_jshort_buf_key); if (j_key_buf == nullptr) { // exception occurred MaybeUnlockForReuse(mtx_short, reuse_jbuf_key); - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return; } jint jkey_len = env->CallStaticIntMethod( - m_abstract_comparator_jni_bridge_clazz, m_jshort_mid, - m_jcallback_obj, + m_abstract_comparator_jni_bridge_clazz, m_jshort_mid, m_jcallback_obj, j_key_buf, reuse_jbuf_key ? key->length() : -1); if (env->ExceptionCheck()) { @@ -459,49 +460,48 @@ void ComparatorJniCallback::FindShortSuccessor( env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return; - } if (static_cast(jkey_len) != key->length()) { // key buffer has changed in Java, so update `key` with the result bool copy_from_non_direct = false; if (reuse_jbuf_key) { - // reused a buffer - if (m_options->direct_buffer) { - // reused direct buffer - void* key_buf = env->GetDirectBufferAddress(j_key_buf); - if (key_buf == nullptr) { - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Unable to get Direct Buffer Address"); - if (!reuse_jbuf_key) { - DeleteBuffer(env, j_key_buf); - } - MaybeUnlockForReuse(mtx_short, reuse_jbuf_key); - env->ExceptionDescribe(); // print out exception to stderr - releaseJniEnv(attached_thread); - return; + // reused a buffer + if (m_options->direct_buffer) { + // reused direct buffer + void* key_buf = env->GetDirectBufferAddress(j_key_buf); + if (key_buf == nullptr) { + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Unable to get Direct Buffer Address"); + if (!reuse_jbuf_key) { + DeleteBuffer(env, j_key_buf); } - key->assign(static_cast(key_buf), jkey_len); - } else { - // reused non-direct buffer - copy_from_non_direct = true; + MaybeUnlockForReuse(mtx_short, reuse_jbuf_key); + env->ExceptionDescribe(); // print out exception to stderr + releaseJniEnv(attached_thread); + return; } + key->assign(static_cast(key_buf), jkey_len); + } else { + // reused non-direct buffer + copy_from_non_direct = true; + } } else { - // there was a new buffer - if (m_options->direct_buffer) { - // it was direct... don't forget to potentially truncate the `key` string - key->resize(jkey_len); - } else { - // it was non-direct - copy_from_non_direct = true; - } + // there was a new buffer + if (m_options->direct_buffer) { + // it was direct... don't forget to potentially truncate the `key` + // string + key->resize(jkey_len); + } else { + // it was non-direct + copy_from_non_direct = true; + } } if (copy_from_non_direct) { - jbyteArray jarray = ByteBufferJni::array(env, j_key_buf, - m_jbytebuffer_clazz); + jbyteArray jarray = + ByteBufferJni::array(env, j_key_buf, m_jbytebuffer_clazz); if (jarray == nullptr) { - if (!reuse_jbuf_key) { DeleteBuffer(env, j_key_buf); } @@ -511,9 +511,12 @@ void ComparatorJniCallback::FindShortSuccessor( return; } jboolean has_exception = JNI_FALSE; - JniUtil::byteString(env, jarray, [key, jkey_len](const char* data, const size_t) { - return key->assign(data, static_cast(jkey_len)); - }, &has_exception); + JniUtil::byteString( + env, jarray, + [key, jkey_len](const char* data, const size_t) { + return key->assign(data, static_cast(jkey_len)); + }, + &has_exception); env->DeleteLocalRef(jarray); if (has_exception == JNI_TRUE) { if (!reuse_jbuf_key) { @@ -539,8 +542,9 @@ void ComparatorJniCallback::FindShortSuccessor( inline void ComparatorJniCallback::MaybeLockForReuse( const std::unique_ptr& mutex, const bool cond) const { // no need to lock if using thread_local - if (m_options->reused_synchronisation_type != ReusedSynchronisationType::THREAD_LOCAL - && cond) { + if (m_options->reused_synchronisation_type != + ReusedSynchronisationType::THREAD_LOCAL && + cond) { mutex.get()->Lock(); } } @@ -548,18 +552,20 @@ inline void ComparatorJniCallback::MaybeLockForReuse( inline void ComparatorJniCallback::MaybeUnlockForReuse( const std::unique_ptr& mutex, const bool cond) const { // no need to unlock if using thread_local - if (m_options->reused_synchronisation_type != ReusedSynchronisationType::THREAD_LOCAL - && cond) { + if (m_options->reused_synchronisation_type != + ReusedSynchronisationType::THREAD_LOCAL && + cond) { mutex.get()->Unlock(); } } jobject ComparatorJniCallback::GetBuffer(JNIEnv* env, const Slice& src, - bool reuse_buffer, ThreadLocalPtr* tl_buf, jobject jreuse_buffer) const { + bool reuse_buffer, + ThreadLocalPtr* tl_buf, + jobject jreuse_buffer) const { if (reuse_buffer) { - if (m_options->reused_synchronisation_type - == ReusedSynchronisationType::THREAD_LOCAL) { - + if (m_options->reused_synchronisation_type == + ReusedSynchronisationType::THREAD_LOCAL) { // reuse thread-local bufffer ThreadLocalBuf* tlb = reinterpret_cast(tl_buf->Get()); if (tlb == nullptr) { @@ -576,25 +582,25 @@ jobject ComparatorJniCallback::GetBuffer(JNIEnv* env, const Slice& src, } return ReuseBuffer(env, src, tlb->jbuf); } else { - // reuse class member buffer return ReuseBuffer(env, src, jreuse_buffer); } } else { - // new buffer return NewBuffer(env, src); } } -jobject ComparatorJniCallback::ReuseBuffer( - JNIEnv* env, const Slice& src, jobject jreuse_buffer) const { +jobject ComparatorJniCallback::ReuseBuffer(JNIEnv* env, const Slice& src, + jobject jreuse_buffer) const { // we can reuse the buffer if (m_options->direct_buffer) { // copy into direct buffer void* buf = env->GetDirectBufferAddress(jreuse_buffer); if (buf == nullptr) { - // either memory region is undefined, given object is not a direct java.nio.Buffer, or JNI access to direct buffers is not supported by this virtual machine. + // either memory region is undefined, given object is not a direct + // java.nio.Buffer, or JNI access to direct buffers is not supported by + // this virtual machine. ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, "Unable to get Direct Buffer Address"); return nullptr; @@ -602,13 +608,14 @@ jobject ComparatorJniCallback::ReuseBuffer( memcpy(buf, src.data(), src.size()); } else { // copy into non-direct buffer - const jbyteArray jarray = ByteBufferJni::array(env, jreuse_buffer, - m_jbytebuffer_clazz); + const jbyteArray jarray = + ByteBufferJni::array(env, jreuse_buffer, m_jbytebuffer_clazz); if (jarray == nullptr) { // exception occurred return nullptr; } - env->SetByteArrayRegion(jarray, 0, static_cast(src.size()), + env->SetByteArrayRegion( + jarray, 0, static_cast(src.size()), const_cast(reinterpret_cast(src.data()))); if (env->ExceptionCheck()) { // exception occurred @@ -622,8 +629,9 @@ jobject ComparatorJniCallback::ReuseBuffer( jobject ComparatorJniCallback::NewBuffer(JNIEnv* env, const Slice& src) const { // we need a new buffer - jobject jbuf = ByteBufferJni::constructWith(env, m_options->direct_buffer, - src.data(), src.size(), m_jbytebuffer_clazz); + jobject jbuf = + ByteBufferJni::constructWith(env, m_options->direct_buffer, src.data(), + src.size(), m_jbytebuffer_clazz); if (jbuf == nullptr) { // exception occurred return nullptr; diff --git a/java/rocksjni/comparatorjnicallback.h b/java/rocksjni/comparatorjnicallback.h index 2e27de008..a983ce4b5 100644 --- a/java/rocksjni/comparatorjnicallback.h +++ b/java/rocksjni/comparatorjnicallback.h @@ -10,12 +10,14 @@ #define JAVA_ROCKSJNI_COMPARATORJNICALLBACK_H_ #include + #include #include -#include "rocksjni/jnicallback.h" + +#include "port/port.h" #include "rocksdb/comparator.h" #include "rocksdb/slice.h" -#include "port/port.h" +#include "rocksjni/jnicallback.h" #include "util/thread_local.h" namespace ROCKSDB_NAMESPACE { @@ -41,7 +43,6 @@ enum ReusedSynchronisationType { }; struct ComparatorJniCallbackOptions { - // Set the synchronisation type used to guard the reused buffers. // Only used if max_reused_buffer_size > 0. // Default: ADAPTIVE_MUTEX @@ -83,54 +84,57 @@ struct ComparatorJniCallbackOptions { */ class ComparatorJniCallback : public JniCallback, public Comparator { public: - ComparatorJniCallback( - JNIEnv* env, jobject jcomparator, - const ComparatorJniCallbackOptions* options); - ~ComparatorJniCallback(); - virtual const char* Name() const; - virtual int Compare(const Slice& a, const Slice& b) const; - virtual void FindShortestSeparator( - std::string* start, const Slice& limit) const; - virtual void FindShortSuccessor(std::string* key) const; - const ComparatorJniCallbackOptions* m_options; + ComparatorJniCallback(JNIEnv* env, jobject jcomparator, + const ComparatorJniCallbackOptions* options); + ~ComparatorJniCallback(); + virtual const char* Name() const; + virtual int Compare(const Slice& a, const Slice& b) const; + virtual void FindShortestSeparator(std::string* start, + const Slice& limit) const; + virtual void FindShortSuccessor(std::string* key) const; + const ComparatorJniCallbackOptions* m_options; private: - struct ThreadLocalBuf { - ThreadLocalBuf(JavaVM* _jvm, bool _direct_buffer, jobject _jbuf) : - jvm(_jvm), direct_buffer(_direct_buffer), jbuf(_jbuf) {} - JavaVM* jvm; - bool direct_buffer; - jobject jbuf; - }; - inline void MaybeLockForReuse(const std::unique_ptr& mutex, - const bool cond) const; - inline void MaybeUnlockForReuse(const std::unique_ptr& mutex, - const bool cond) const; - jobject GetBuffer(JNIEnv* env, const Slice& src, bool reuse_buffer, - ThreadLocalPtr* tl_buf, jobject jreuse_buffer) const; - jobject ReuseBuffer(JNIEnv* env, const Slice& src, - jobject jreuse_buffer) const; - jobject NewBuffer(JNIEnv* env, const Slice& src) const; - void DeleteBuffer(JNIEnv* env, jobject jbuffer) const; - // used for synchronisation in compare method - std::unique_ptr mtx_compare; - // used for synchronisation in findShortestSeparator method - std::unique_ptr mtx_shortest; - // used for synchronisation in findShortSuccessor method - std::unique_ptr mtx_short; - std::unique_ptr m_name; - jclass m_abstract_comparator_jni_bridge_clazz; // TODO(AR) could we make this static somehow? - jclass m_jbytebuffer_clazz; // TODO(AR) we could cache this globally for the entire VM if we switch more APIs to use ByteBuffer // TODO(AR) could we make this static somehow? - jmethodID m_jcompare_mid; // TODO(AR) could we make this static somehow? - jmethodID m_jshortest_mid; // TODO(AR) could we make this static somehow? - jmethodID m_jshort_mid; // TODO(AR) could we make this static somehow? - jobject m_jcompare_buf_a; - jobject m_jcompare_buf_b; - jobject m_jshortest_buf_start; - jobject m_jshortest_buf_limit; - jobject m_jshort_buf_key; - ThreadLocalPtr* m_tl_buf_a; - ThreadLocalPtr* m_tl_buf_b; + struct ThreadLocalBuf { + ThreadLocalBuf(JavaVM* _jvm, bool _direct_buffer, jobject _jbuf) + : jvm(_jvm), direct_buffer(_direct_buffer), jbuf(_jbuf) {} + JavaVM* jvm; + bool direct_buffer; + jobject jbuf; + }; + inline void MaybeLockForReuse(const std::unique_ptr& mutex, + const bool cond) const; + inline void MaybeUnlockForReuse(const std::unique_ptr& mutex, + const bool cond) const; + jobject GetBuffer(JNIEnv* env, const Slice& src, bool reuse_buffer, + ThreadLocalPtr* tl_buf, jobject jreuse_buffer) const; + jobject ReuseBuffer(JNIEnv* env, const Slice& src, + jobject jreuse_buffer) const; + jobject NewBuffer(JNIEnv* env, const Slice& src) const; + void DeleteBuffer(JNIEnv* env, jobject jbuffer) const; + // used for synchronisation in compare method + std::unique_ptr mtx_compare; + // used for synchronisation in findShortestSeparator method + std::unique_ptr mtx_shortest; + // used for synchronisation in findShortSuccessor method + std::unique_ptr mtx_short; + std::unique_ptr m_name; + jclass m_abstract_comparator_jni_bridge_clazz; // TODO(AR) could we make this + // static somehow? + jclass m_jbytebuffer_clazz; // TODO(AR) we could cache this globally for the + // entire VM if we switch more APIs to use + // ByteBuffer // TODO(AR) could we make this + // static somehow? + jmethodID m_jcompare_mid; // TODO(AR) could we make this static somehow? + jmethodID m_jshortest_mid; // TODO(AR) could we make this static somehow? + jmethodID m_jshort_mid; // TODO(AR) could we make this static somehow? + jobject m_jcompare_buf_a; + jobject m_jcompare_buf_b; + jobject m_jshortest_buf_start; + jobject m_jshortest_buf_limit; + jobject m_jshort_buf_key; + ThreadLocalPtr* m_tl_buf_a; + ThreadLocalPtr* m_tl_buf_b; }; } // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/compression_options.cc b/java/rocksjni/compression_options.cc index 78ea2a559..53f240560 100644 --- a/java/rocksjni/compression_options.cc +++ b/java/rocksjni/compression_options.cc @@ -17,8 +17,8 @@ * Method: newCompressionOptions * Signature: ()J */ -jlong Java_org_rocksdb_CompressionOptions_newCompressionOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_CompressionOptions_newCompressionOptions(JNIEnv*, + jclass) { const auto* opt = new ROCKSDB_NAMESPACE::CompressionOptions(); return GET_CPLUSPLUS_POINTER(opt); } @@ -28,8 +28,9 @@ jlong Java_org_rocksdb_CompressionOptions_newCompressionOptions( * Method: setWindowBits * Signature: (JI)V */ -void Java_org_rocksdb_CompressionOptions_setWindowBits( - JNIEnv*, jobject, jlong jhandle, jint jwindow_bits) { +void Java_org_rocksdb_CompressionOptions_setWindowBits(JNIEnv*, jobject, + jlong jhandle, + jint jwindow_bits) { auto* opt = reinterpret_cast(jhandle); opt->window_bits = static_cast(jwindow_bits); } @@ -39,8 +40,8 @@ void Java_org_rocksdb_CompressionOptions_setWindowBits( * Method: windowBits * Signature: (J)I */ -jint Java_org_rocksdb_CompressionOptions_windowBits( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompressionOptions_windowBits(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->window_bits); } @@ -50,8 +51,8 @@ jint Java_org_rocksdb_CompressionOptions_windowBits( * Method: setLevel * Signature: (JI)V */ -void Java_org_rocksdb_CompressionOptions_setLevel( - JNIEnv*, jobject, jlong jhandle, jint jlevel) { +void Java_org_rocksdb_CompressionOptions_setLevel(JNIEnv*, jobject, + jlong jhandle, jint jlevel) { auto* opt = reinterpret_cast(jhandle); opt->level = static_cast(jlevel); } @@ -61,8 +62,8 @@ void Java_org_rocksdb_CompressionOptions_setLevel( * Method: level * Signature: (J)I */ -jint Java_org_rocksdb_CompressionOptions_level( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompressionOptions_level(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->level); } @@ -72,8 +73,9 @@ jint Java_org_rocksdb_CompressionOptions_level( * Method: setStrategy * Signature: (JI)V */ -void Java_org_rocksdb_CompressionOptions_setStrategy( - JNIEnv*, jobject, jlong jhandle, jint jstrategy) { +void Java_org_rocksdb_CompressionOptions_setStrategy(JNIEnv*, jobject, + jlong jhandle, + jint jstrategy) { auto* opt = reinterpret_cast(jhandle); opt->strategy = static_cast(jstrategy); } @@ -83,8 +85,8 @@ void Java_org_rocksdb_CompressionOptions_setStrategy( * Method: strategy * Signature: (J)I */ -jint Java_org_rocksdb_CompressionOptions_strategy( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompressionOptions_strategy(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->strategy); } @@ -94,8 +96,9 @@ jint Java_org_rocksdb_CompressionOptions_strategy( * Method: setMaxDictBytes * Signature: (JI)V */ -void Java_org_rocksdb_CompressionOptions_setMaxDictBytes( - JNIEnv*, jobject, jlong jhandle, jint jmax_dict_bytes) { +void Java_org_rocksdb_CompressionOptions_setMaxDictBytes(JNIEnv*, jobject, + jlong jhandle, + jint jmax_dict_bytes) { auto* opt = reinterpret_cast(jhandle); opt->max_dict_bytes = static_cast(jmax_dict_bytes); } @@ -105,8 +108,8 @@ void Java_org_rocksdb_CompressionOptions_setMaxDictBytes( * Method: maxDictBytes * Signature: (J)I */ -jint Java_org_rocksdb_CompressionOptions_maxDictBytes( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompressionOptions_maxDictBytes(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_dict_bytes); } @@ -127,8 +130,8 @@ void Java_org_rocksdb_CompressionOptions_setZstdMaxTrainBytes( * Method: zstdMaxTrainBytes * Signature: (J)I */ -jint Java_org_rocksdb_CompressionOptions_zstdMaxTrainBytes( - JNIEnv *, jobject, jlong jhandle) { +jint Java_org_rocksdb_CompressionOptions_zstdMaxTrainBytes(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->zstd_max_train_bytes); } @@ -183,8 +186,9 @@ jboolean Java_org_rocksdb_CompressionOptions_useZstdDictTrainer(JNIEnv*, * Method: setEnabled * Signature: (JZ)V */ -void Java_org_rocksdb_CompressionOptions_setEnabled( - JNIEnv*, jobject, jlong jhandle, jboolean jenabled) { +void Java_org_rocksdb_CompressionOptions_setEnabled(JNIEnv*, jobject, + jlong jhandle, + jboolean jenabled) { auto* opt = reinterpret_cast(jhandle); opt->enabled = jenabled == JNI_TRUE; } @@ -194,8 +198,8 @@ void Java_org_rocksdb_CompressionOptions_setEnabled( * Method: enabled * Signature: (J)Z */ -jboolean Java_org_rocksdb_CompressionOptions_enabled( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_CompressionOptions_enabled(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enabled); } @@ -204,7 +208,7 @@ jboolean Java_org_rocksdb_CompressionOptions_enabled( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_CompressionOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_CompressionOptions_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { delete reinterpret_cast(jhandle); } diff --git a/java/rocksjni/config_options.cc b/java/rocksjni/config_options.cc index 3cda2524e..e62111323 100644 --- a/java/rocksjni/config_options.cc +++ b/java/rocksjni/config_options.cc @@ -85,5 +85,6 @@ void Java_org_rocksdb_ConfigOptions_setInputStringsEscaped(JNIEnv *, jclass, void Java_org_rocksdb_ConfigOptions_setSanityLevel(JNIEnv *, jclass, jlong handle, jbyte level) { auto *cfg_opt = reinterpret_cast(handle); - cfg_opt->sanity_level = ROCKSDB_NAMESPACE::SanityLevelJni::toCppSanityLevel(level); + cfg_opt->sanity_level = + ROCKSDB_NAMESPACE::SanityLevelJni::toCppSanityLevel(level); } diff --git a/java/rocksjni/env.cc b/java/rocksjni/env.cc index b40a9b1d5..bb739fe2b 100644 --- a/java/rocksjni/env.cc +++ b/java/rocksjni/env.cc @@ -24,8 +24,7 @@ * Method: getDefaultEnvInternal * Signature: ()J */ -jlong Java_org_rocksdb_Env_getDefaultEnvInternal( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_Env_getDefaultEnvInternal(JNIEnv*, jclass) { return GET_CPLUSPLUS_POINTER(ROCKSDB_NAMESPACE::Env::Default()); } @@ -34,8 +33,8 @@ jlong Java_org_rocksdb_Env_getDefaultEnvInternal( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_RocksEnv_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_RocksEnv_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; @@ -46,8 +45,9 @@ void Java_org_rocksdb_RocksEnv_disposeInternal( * Method: setBackgroundThreads * Signature: (JIB)V */ -void Java_org_rocksdb_Env_setBackgroundThreads( - JNIEnv*, jobject, jlong jhandle, jint jnum, jbyte jpriority_value) { +void Java_org_rocksdb_Env_setBackgroundThreads(JNIEnv*, jobject, jlong jhandle, + jint jnum, + jbyte jpriority_value) { auto* rocks_env = reinterpret_cast(jhandle); rocks_env->SetBackgroundThreads( static_cast(jnum), @@ -59,8 +59,8 @@ void Java_org_rocksdb_Env_setBackgroundThreads( * Method: getBackgroundThreads * Signature: (JB)I */ -jint Java_org_rocksdb_Env_getBackgroundThreads( - JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { +jint Java_org_rocksdb_Env_getBackgroundThreads(JNIEnv*, jobject, jlong jhandle, + jbyte jpriority_value) { auto* rocks_env = reinterpret_cast(jhandle); const int num = rocks_env->GetBackgroundThreads( ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); @@ -72,8 +72,8 @@ jint Java_org_rocksdb_Env_getBackgroundThreads( * Method: getThreadPoolQueueLen * Signature: (JB)I */ -jint Java_org_rocksdb_Env_getThreadPoolQueueLen( - JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { +jint Java_org_rocksdb_Env_getThreadPoolQueueLen(JNIEnv*, jobject, jlong jhandle, + jbyte jpriority_value) { auto* rocks_env = reinterpret_cast(jhandle); const int queue_len = rocks_env->GetThreadPoolQueueLen( ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); @@ -85,8 +85,9 @@ jint Java_org_rocksdb_Env_getThreadPoolQueueLen( * Method: incBackgroundThreadsIfNeeded * Signature: (JIB)V */ -void Java_org_rocksdb_Env_incBackgroundThreadsIfNeeded( - JNIEnv*, jobject, jlong jhandle, jint jnum, jbyte jpriority_value) { +void Java_org_rocksdb_Env_incBackgroundThreadsIfNeeded(JNIEnv*, jobject, + jlong jhandle, jint jnum, + jbyte jpriority_value) { auto* rocks_env = reinterpret_cast(jhandle); rocks_env->IncBackgroundThreadsIfNeeded( static_cast(jnum), @@ -98,8 +99,9 @@ void Java_org_rocksdb_Env_incBackgroundThreadsIfNeeded( * Method: lowerThreadPoolIOPriority * Signature: (JB)V */ -void Java_org_rocksdb_Env_lowerThreadPoolIOPriority( - JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { +void Java_org_rocksdb_Env_lowerThreadPoolIOPriority(JNIEnv*, jobject, + jlong jhandle, + jbyte jpriority_value) { auto* rocks_env = reinterpret_cast(jhandle); rocks_env->LowerThreadPoolIOPriority( ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); @@ -110,8 +112,9 @@ void Java_org_rocksdb_Env_lowerThreadPoolIOPriority( * Method: lowerThreadPoolCPUPriority * Signature: (JB)V */ -void Java_org_rocksdb_Env_lowerThreadPoolCPUPriority( - JNIEnv*, jobject, jlong jhandle, jbyte jpriority_value) { +void Java_org_rocksdb_Env_lowerThreadPoolCPUPriority(JNIEnv*, jobject, + jlong jhandle, + jbyte jpriority_value) { auto* rocks_env = reinterpret_cast(jhandle); rocks_env->LowerThreadPoolCPUPriority( ROCKSDB_NAMESPACE::PriorityJni::toCppPriority(jpriority_value)); @@ -122,8 +125,8 @@ void Java_org_rocksdb_Env_lowerThreadPoolCPUPriority( * Method: getThreadList * Signature: (J)[Lorg/rocksdb/ThreadStatus; */ -jobjectArray Java_org_rocksdb_Env_getThreadList( - JNIEnv* env, jobject, jlong jhandle) { +jobjectArray Java_org_rocksdb_Env_getThreadList(JNIEnv* env, jobject, + jlong jhandle) { auto* rocks_env = reinterpret_cast(jhandle); std::vector thread_status; ROCKSDB_NAMESPACE::Status s = rocks_env->GetThreadList(&thread_status); @@ -160,8 +163,8 @@ jobjectArray Java_org_rocksdb_Env_getThreadList( * Method: createMemEnv * Signature: (J)J */ -jlong Java_org_rocksdb_RocksMemEnv_createMemEnv( - JNIEnv*, jclass, jlong jbase_env_handle) { +jlong Java_org_rocksdb_RocksMemEnv_createMemEnv(JNIEnv*, jclass, + jlong jbase_env_handle) { auto* base_env = reinterpret_cast(jbase_env_handle); return GET_CPLUSPLUS_POINTER(ROCKSDB_NAMESPACE::NewMemEnv(base_env)); } @@ -171,8 +174,8 @@ jlong Java_org_rocksdb_RocksMemEnv_createMemEnv( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_RocksMemEnv_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_RocksMemEnv_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; @@ -183,8 +186,8 @@ void Java_org_rocksdb_RocksMemEnv_disposeInternal( * Method: createTimedEnv * Signature: (J)J */ -jlong Java_org_rocksdb_TimedEnv_createTimedEnv( - JNIEnv*, jclass, jlong jbase_env_handle) { +jlong Java_org_rocksdb_TimedEnv_createTimedEnv(JNIEnv*, jclass, + jlong jbase_env_handle) { auto* base_env = reinterpret_cast(jbase_env_handle); return GET_CPLUSPLUS_POINTER(ROCKSDB_NAMESPACE::NewTimedEnv(base_env)); } @@ -194,10 +197,9 @@ jlong Java_org_rocksdb_TimedEnv_createTimedEnv( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_TimedEnv_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_TimedEnv_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* e = reinterpret_cast(jhandle); assert(e != nullptr); delete e; } - diff --git a/java/rocksjni/env_options.cc b/java/rocksjni/env_options.cc index 64c948332..3237e2775 100644 --- a/java/rocksjni/env_options.cc +++ b/java/rocksjni/env_options.cc @@ -33,8 +33,7 @@ * Method: newEnvOptions * Signature: ()J */ -jlong Java_org_rocksdb_EnvOptions_newEnvOptions__( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_EnvOptions_newEnvOptions__(JNIEnv *, jclass) { auto *env_opt = new ROCKSDB_NAMESPACE::EnvOptions(); return GET_CPLUSPLUS_POINTER(env_opt); } @@ -44,8 +43,8 @@ jlong Java_org_rocksdb_EnvOptions_newEnvOptions__( * Method: newEnvOptions * Signature: (J)J */ -jlong Java_org_rocksdb_EnvOptions_newEnvOptions__J( - JNIEnv*, jclass, jlong jdboptions_handle) { +jlong Java_org_rocksdb_EnvOptions_newEnvOptions__J(JNIEnv *, jclass, + jlong jdboptions_handle) { auto *db_options = reinterpret_cast(jdboptions_handle); auto *env_opt = new ROCKSDB_NAMESPACE::EnvOptions(*db_options); @@ -57,8 +56,8 @@ jlong Java_org_rocksdb_EnvOptions_newEnvOptions__J( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_EnvOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_EnvOptions_disposeInternal(JNIEnv *, jobject, + jlong jhandle) { auto *eo = reinterpret_cast(jhandle); assert(eo != nullptr); delete eo; @@ -69,8 +68,9 @@ void Java_org_rocksdb_EnvOptions_disposeInternal( * Method: setUseMmapReads * Signature: (JZ)V */ -void Java_org_rocksdb_EnvOptions_setUseMmapReads( - JNIEnv*, jobject, jlong jhandle, jboolean use_mmap_reads) { +void Java_org_rocksdb_EnvOptions_setUseMmapReads(JNIEnv *, jobject, + jlong jhandle, + jboolean use_mmap_reads) { ENV_OPTIONS_SET_BOOL(jhandle, use_mmap_reads); } @@ -79,8 +79,8 @@ void Java_org_rocksdb_EnvOptions_setUseMmapReads( * Method: useMmapReads * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_useMmapReads( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_useMmapReads(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, use_mmap_reads); } @@ -89,8 +89,9 @@ jboolean Java_org_rocksdb_EnvOptions_useMmapReads( * Method: setUseMmapWrites * Signature: (JZ)V */ -void Java_org_rocksdb_EnvOptions_setUseMmapWrites( - JNIEnv*, jobject, jlong jhandle, jboolean use_mmap_writes) { +void Java_org_rocksdb_EnvOptions_setUseMmapWrites(JNIEnv *, jobject, + jlong jhandle, + jboolean use_mmap_writes) { ENV_OPTIONS_SET_BOOL(jhandle, use_mmap_writes); } @@ -99,8 +100,8 @@ void Java_org_rocksdb_EnvOptions_setUseMmapWrites( * Method: useMmapWrites * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_useMmapWrites( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_useMmapWrites(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, use_mmap_writes); } @@ -109,8 +110,9 @@ jboolean Java_org_rocksdb_EnvOptions_useMmapWrites( * Method: setUseDirectReads * Signature: (JZ)V */ -void Java_org_rocksdb_EnvOptions_setUseDirectReads( - JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) { +void Java_org_rocksdb_EnvOptions_setUseDirectReads(JNIEnv *, jobject, + jlong jhandle, + jboolean use_direct_reads) { ENV_OPTIONS_SET_BOOL(jhandle, use_direct_reads); } @@ -119,8 +121,8 @@ void Java_org_rocksdb_EnvOptions_setUseDirectReads( * Method: useDirectReads * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_useDirectReads( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_useDirectReads(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, use_direct_reads); } @@ -130,7 +132,7 @@ jboolean Java_org_rocksdb_EnvOptions_useDirectReads( * Signature: (JZ)V */ void Java_org_rocksdb_EnvOptions_setUseDirectWrites( - JNIEnv*, jobject, jlong jhandle, jboolean use_direct_writes) { + JNIEnv *, jobject, jlong jhandle, jboolean use_direct_writes) { ENV_OPTIONS_SET_BOOL(jhandle, use_direct_writes); } @@ -139,8 +141,8 @@ void Java_org_rocksdb_EnvOptions_setUseDirectWrites( * Method: useDirectWrites * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_useDirectWrites( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_useDirectWrites(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, use_direct_writes); } @@ -149,8 +151,9 @@ jboolean Java_org_rocksdb_EnvOptions_useDirectWrites( * Method: setAllowFallocate * Signature: (JZ)V */ -void Java_org_rocksdb_EnvOptions_setAllowFallocate( - JNIEnv*, jobject, jlong jhandle, jboolean allow_fallocate) { +void Java_org_rocksdb_EnvOptions_setAllowFallocate(JNIEnv *, jobject, + jlong jhandle, + jboolean allow_fallocate) { ENV_OPTIONS_SET_BOOL(jhandle, allow_fallocate); } @@ -159,8 +162,8 @@ void Java_org_rocksdb_EnvOptions_setAllowFallocate( * Method: allowFallocate * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_allowFallocate( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_allowFallocate(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, allow_fallocate); } @@ -169,8 +172,9 @@ jboolean Java_org_rocksdb_EnvOptions_allowFallocate( * Method: setSetFdCloexec * Signature: (JZ)V */ -void Java_org_rocksdb_EnvOptions_setSetFdCloexec( - JNIEnv*, jobject, jlong jhandle, jboolean set_fd_cloexec) { +void Java_org_rocksdb_EnvOptions_setSetFdCloexec(JNIEnv *, jobject, + jlong jhandle, + jboolean set_fd_cloexec) { ENV_OPTIONS_SET_BOOL(jhandle, set_fd_cloexec); } @@ -179,8 +183,8 @@ void Java_org_rocksdb_EnvOptions_setSetFdCloexec( * Method: setFdCloexec * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_setFdCloexec( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_setFdCloexec(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, set_fd_cloexec); } @@ -189,8 +193,9 @@ jboolean Java_org_rocksdb_EnvOptions_setFdCloexec( * Method: setBytesPerSync * Signature: (JJ)V */ -void Java_org_rocksdb_EnvOptions_setBytesPerSync( - JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) { +void Java_org_rocksdb_EnvOptions_setBytesPerSync(JNIEnv *, jobject, + jlong jhandle, + jlong bytes_per_sync) { ENV_OPTIONS_SET_UINT64_T(jhandle, bytes_per_sync); } @@ -199,8 +204,8 @@ void Java_org_rocksdb_EnvOptions_setBytesPerSync( * Method: bytesPerSync * Signature: (J)J */ -jlong Java_org_rocksdb_EnvOptions_bytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_EnvOptions_bytesPerSync(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, bytes_per_sync); } @@ -210,7 +215,7 @@ jlong Java_org_rocksdb_EnvOptions_bytesPerSync( * Signature: (JZ)V */ void Java_org_rocksdb_EnvOptions_setFallocateWithKeepSize( - JNIEnv*, jobject, jlong jhandle, jboolean fallocate_with_keep_size) { + JNIEnv *, jobject, jlong jhandle, jboolean fallocate_with_keep_size) { ENV_OPTIONS_SET_BOOL(jhandle, fallocate_with_keep_size); } @@ -219,8 +224,8 @@ void Java_org_rocksdb_EnvOptions_setFallocateWithKeepSize( * Method: fallocateWithKeepSize * Signature: (J)Z */ -jboolean Java_org_rocksdb_EnvOptions_fallocateWithKeepSize( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_EnvOptions_fallocateWithKeepSize(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, fallocate_with_keep_size); } @@ -230,7 +235,7 @@ jboolean Java_org_rocksdb_EnvOptions_fallocateWithKeepSize( * Signature: (JJ)V */ void Java_org_rocksdb_EnvOptions_setCompactionReadaheadSize( - JNIEnv*, jobject, jlong jhandle, jlong compaction_readahead_size) { + JNIEnv *, jobject, jlong jhandle, jlong compaction_readahead_size) { ENV_OPTIONS_SET_SIZE_T(jhandle, compaction_readahead_size); } @@ -239,8 +244,8 @@ void Java_org_rocksdb_EnvOptions_setCompactionReadaheadSize( * Method: compactionReadaheadSize * Signature: (J)J */ -jlong Java_org_rocksdb_EnvOptions_compactionReadaheadSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_EnvOptions_compactionReadaheadSize(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, compaction_readahead_size); } @@ -250,7 +255,7 @@ jlong Java_org_rocksdb_EnvOptions_compactionReadaheadSize( * Signature: (JJ)V */ void Java_org_rocksdb_EnvOptions_setRandomAccessMaxBufferSize( - JNIEnv*, jobject, jlong jhandle, jlong random_access_max_buffer_size) { + JNIEnv *, jobject, jlong jhandle, jlong random_access_max_buffer_size) { ENV_OPTIONS_SET_SIZE_T(jhandle, random_access_max_buffer_size); } @@ -259,8 +264,8 @@ void Java_org_rocksdb_EnvOptions_setRandomAccessMaxBufferSize( * Method: randomAccessMaxBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_EnvOptions_randomAccessMaxBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_EnvOptions_randomAccessMaxBufferSize(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, random_access_max_buffer_size); } @@ -270,7 +275,7 @@ jlong Java_org_rocksdb_EnvOptions_randomAccessMaxBufferSize( * Signature: (JJ)V */ void Java_org_rocksdb_EnvOptions_setWritableFileMaxBufferSize( - JNIEnv*, jobject, jlong jhandle, jlong writable_file_max_buffer_size) { + JNIEnv *, jobject, jlong jhandle, jlong writable_file_max_buffer_size) { ENV_OPTIONS_SET_SIZE_T(jhandle, writable_file_max_buffer_size); } @@ -279,8 +284,8 @@ void Java_org_rocksdb_EnvOptions_setWritableFileMaxBufferSize( * Method: writableFileMaxBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_EnvOptions_writableFileMaxBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_EnvOptions_writableFileMaxBufferSize(JNIEnv *, jobject, + jlong jhandle) { return ENV_OPTIONS_GET(jhandle, writable_file_max_buffer_size); } @@ -289,8 +294,9 @@ jlong Java_org_rocksdb_EnvOptions_writableFileMaxBufferSize( * Method: setRateLimiter * Signature: (JJ)V */ -void Java_org_rocksdb_EnvOptions_setRateLimiter( - JNIEnv*, jobject, jlong jhandle, jlong rl_handle) { +void Java_org_rocksdb_EnvOptions_setRateLimiter(JNIEnv *, jobject, + jlong jhandle, + jlong rl_handle) { auto *sptr_rate_limiter = reinterpret_cast *>( rl_handle); diff --git a/java/rocksjni/ingest_external_file_options.cc b/java/rocksjni/ingest_external_file_options.cc index 4460c8040..052cf3325 100644 --- a/java/rocksjni/ingest_external_file_options.cc +++ b/java/rocksjni/ingest_external_file_options.cc @@ -29,9 +29,8 @@ jlong Java_org_rocksdb_IngestExternalFileOptions_newIngestExternalFileOptions__( * Signature: (ZZZZ)J */ jlong Java_org_rocksdb_IngestExternalFileOptions_newIngestExternalFileOptions__ZZZZ( - JNIEnv*, jclass, jboolean jmove_files, - jboolean jsnapshot_consistency, jboolean jallow_global_seqno, - jboolean jallow_blocking_flush) { + JNIEnv*, jclass, jboolean jmove_files, jboolean jsnapshot_consistency, + jboolean jallow_global_seqno, jboolean jallow_blocking_flush) { auto* options = new ROCKSDB_NAMESPACE::IngestExternalFileOptions(); options->move_files = static_cast(jmove_files); options->snapshot_consistency = static_cast(jsnapshot_consistency); @@ -45,8 +44,8 @@ jlong Java_org_rocksdb_IngestExternalFileOptions_newIngestExternalFileOptions__Z * Method: moveFiles * Signature: (J)Z */ -jboolean Java_org_rocksdb_IngestExternalFileOptions_moveFiles( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_IngestExternalFileOptions_moveFiles(JNIEnv*, jobject, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return static_cast(options->move_files); @@ -165,8 +164,9 @@ void Java_org_rocksdb_IngestExternalFileOptions_setIngestBehind( * Method: writeGlobalSeqno * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_rocksdb_IngestExternalFileOptions_writeGlobalSeqno( - JNIEnv*, jobject, jlong jhandle) { +JNIEXPORT jboolean JNICALL +Java_org_rocksdb_IngestExternalFileOptions_writeGlobalSeqno(JNIEnv*, jobject, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return options->write_global_seqno == JNI_TRUE; @@ -177,7 +177,8 @@ JNIEXPORT jboolean JNICALL Java_org_rocksdb_IngestExternalFileOptions_writeGloba * Method: setWriteGlobalSeqno * Signature: (JZ)V */ -JNIEXPORT void JNICALL Java_org_rocksdb_IngestExternalFileOptions_setWriteGlobalSeqno( +JNIEXPORT void JNICALL +Java_org_rocksdb_IngestExternalFileOptions_setWriteGlobalSeqno( JNIEnv*, jobject, jlong jhandle, jboolean jwrite_global_seqno) { auto* options = reinterpret_cast(jhandle); @@ -189,8 +190,9 @@ JNIEXPORT void JNICALL Java_org_rocksdb_IngestExternalFileOptions_setWriteGlobal * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_IngestExternalFileOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_IngestExternalFileOptions_disposeInternal(JNIEnv*, + jobject, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); delete options; diff --git a/java/rocksjni/jnicallback.cc b/java/rocksjni/jnicallback.cc index 28d84f277..f2742cd88 100644 --- a/java/rocksjni/jnicallback.cc +++ b/java/rocksjni/jnicallback.cc @@ -6,8 +6,10 @@ // This file implements the callback "bridge" between Java and C++ for // JNI Callbacks from C++ to sub-classes or org.rocksdb.RocksCallbackObject -#include #include "rocksjni/jnicallback.h" + +#include + #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { @@ -15,7 +17,7 @@ JniCallback::JniCallback(JNIEnv* env, jobject jcallback_obj) { // Note: jcallback_obj may be accessed by multiple threads, // so we ref the jvm not the env const jint rs = env->GetJavaVM(&m_jvm); - if(rs != JNI_OK) { + if (rs != JNI_OK) { // exception thrown return; } @@ -24,7 +26,7 @@ JniCallback::JniCallback(JNIEnv* env, jobject jcallback_obj) { // across multiple method calls, so we create a global ref assert(jcallback_obj != nullptr); m_jcallback_obj = env->NewGlobalRef(jcallback_obj); - if(jcallback_obj == nullptr) { + if (jcallback_obj == nullptr) { // exception thrown: OutOfMemoryError return; } diff --git a/java/rocksjni/jnicallback.h b/java/rocksjni/jnicallback.h index 5baa8973c..a03a04128 100644 --- a/java/rocksjni/jnicallback.h +++ b/java/rocksjni/jnicallback.h @@ -26,7 +26,7 @@ class JniCallback { jobject m_jcallback_obj; JNIEnv* getJniEnv(jboolean* attached) const; void releaseJniEnv(jboolean& attached) const; - }; - } // namespace ROCKSDB_NAMESPACE +}; +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_JNICALLBACK_H_ diff --git a/java/rocksjni/loggerjnicallback.h b/java/rocksjni/loggerjnicallback.h index 7bcba82ee..57774988c 100644 --- a/java/rocksjni/loggerjnicallback.h +++ b/java/rocksjni/loggerjnicallback.h @@ -10,11 +10,13 @@ #define JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_ #include + #include #include -#include "rocksjni/jnicallback.h" + #include "port/port.h" #include "rocksdb/env.h" +#include "rocksjni/jnicallback.h" namespace ROCKSDB_NAMESPACE { @@ -23,8 +25,8 @@ class LoggerJniCallback : public JniCallback, public Logger { LoggerJniCallback(JNIEnv* env, jobject jLogger); ~LoggerJniCallback(); - using Logger::SetInfoLogLevel; using Logger::GetInfoLogLevel; + using Logger::SetInfoLogLevel; // Write an entry to the log file with the specified format. virtual void Logv(const char* format, va_list ap); // Write an entry to the log file with the specified log level @@ -43,7 +45,7 @@ class LoggerJniCallback : public JniCallback, public Logger { jobject m_jfatal_level; jobject m_jheader_level; std::unique_ptr format_str(const char* format, va_list ap) const; - }; - } // namespace ROCKSDB_NAMESPACE +}; +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_LOGGERJNICALLBACK_H_ diff --git a/java/rocksjni/memory_util.cc b/java/rocksjni/memory_util.cc index 07284d434..c87c4f403 100644 --- a/java/rocksjni/memory_util.cc +++ b/java/rocksjni/memory_util.cc @@ -3,19 +3,18 @@ // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). +#include "rocksdb/utilities/memory_util.h" + #include + #include #include #include #include #include "include/org_rocksdb_MemoryUtil.h" - #include "rocksjni/portal.h" -#include "rocksdb/utilities/memory_util.h" - - /* * Class: org_rocksdb_MemoryUtil * Method: getApproximateMemoryUsageByType @@ -34,8 +33,9 @@ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( std::unordered_set cache_set; jsize cache_handle_count = env->GetArrayLength(jcache_handles); - if(cache_handle_count > 0) { - jlong *ptr_jcache_handles = env->GetLongArrayElements(jcache_handles, nullptr); + if (cache_handle_count > 0) { + jlong *ptr_jcache_handles = + env->GetLongArrayElements(jcache_handles, nullptr); if (ptr_jcache_handles == nullptr) { // exception thrown: OutOfMemoryError return nullptr; @@ -46,7 +46,8 @@ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( ptr_jcache_handles[i]); cache_set.insert(cache_ptr->get()); } - env->ReleaseLongArrayElements(jcache_handles, ptr_jcache_handles, JNI_ABORT); + env->ReleaseLongArrayElements(jcache_handles, ptr_jcache_handles, + JNI_ABORT); } std::map usage_by_type; @@ -85,8 +86,7 @@ jobject Java_org_rocksdb_MemoryUtil_getApproximateMemoryUsageByType( } // Construct and return pointer to pair of jobjects return std::unique_ptr>( - new std::pair(jusage_type, - jusage_value)); + new std::pair(jusage_type, jusage_value)); }; if (!ROCKSDB_NAMESPACE::HashMapJni::putAll(env, jusage_by_type, diff --git a/java/rocksjni/optimistic_transaction_db.cc b/java/rocksjni/optimistic_transaction_db.cc index dd507caa7..2a5c2e5d4 100644 --- a/java/rocksjni/optimistic_transaction_db.cc +++ b/java/rocksjni/optimistic_transaction_db.cc @@ -159,8 +159,8 @@ Java_org_rocksdb_OptimisticTransactionDB_open__JLjava_lang_String_2_3_3B_3J( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_OptimisticTransactionDB_disposeInternal( - JNIEnv *, jobject, jlong jhandle) { +void Java_org_rocksdb_OptimisticTransactionDB_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* optimistic_txn_db = reinterpret_cast(jhandle); assert(optimistic_txn_db != nullptr); @@ -172,8 +172,8 @@ void Java_org_rocksdb_OptimisticTransactionDB_disposeInternal( * Method: closeDatabase * Signature: (J)V */ -void Java_org_rocksdb_OptimisticTransactionDB_closeDatabase( - JNIEnv* env, jclass, jlong jhandle) { +void Java_org_rocksdb_OptimisticTransactionDB_closeDatabase(JNIEnv* env, jclass, + jlong jhandle) { auto* optimistic_txn_db = reinterpret_cast(jhandle); assert(optimistic_txn_db != nullptr); @@ -276,8 +276,8 @@ jlong Java_org_rocksdb_OptimisticTransactionDB_beginTransaction_1withOld__JJJJ( * Method: getBaseDB * Signature: (J)J */ -jlong Java_org_rocksdb_OptimisticTransactionDB_getBaseDB( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_OptimisticTransactionDB_getBaseDB(JNIEnv*, jobject, + jlong jhandle) { auto* optimistic_txn_db = reinterpret_cast(jhandle); return GET_CPLUSPLUS_POINTER(optimistic_txn_db->GetBaseDB()); diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 34eb900b3..b848ea9cf 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -44,8 +44,7 @@ * Method: newOptions * Signature: ()J */ -jlong Java_org_rocksdb_Options_newOptions__( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_Options_newOptions__(JNIEnv*, jclass) { auto* op = new ROCKSDB_NAMESPACE::Options(); return GET_CPLUSPLUS_POINTER(op); } @@ -55,8 +54,8 @@ jlong Java_org_rocksdb_Options_newOptions__( * Method: newOptions * Signature: (JJ)J */ -jlong Java_org_rocksdb_Options_newOptions__JJ( - JNIEnv*, jclass, jlong jdboptions, jlong jcfoptions) { +jlong Java_org_rocksdb_Options_newOptions__JJ(JNIEnv*, jclass, jlong jdboptions, + jlong jcfoptions) { auto* dbOpt = reinterpret_cast(jdboptions); auto* cfOpt = reinterpret_cast( @@ -70,8 +69,7 @@ jlong Java_org_rocksdb_Options_newOptions__JJ( * Method: copyOptions * Signature: (J)J */ -jlong Java_org_rocksdb_Options_copyOptions( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_Options_copyOptions(JNIEnv*, jclass, jlong jhandle) { auto new_opt = new ROCKSDB_NAMESPACE::Options( *(reinterpret_cast(jhandle))); return GET_CPLUSPLUS_POINTER(new_opt); @@ -82,8 +80,7 @@ jlong Java_org_rocksdb_Options_copyOptions( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_Options_disposeInternal( - JNIEnv*, jobject, jlong handle) { +void Java_org_rocksdb_Options_disposeInternal(JNIEnv*, jobject, jlong handle) { auto* op = reinterpret_cast(handle); assert(op != nullptr); delete op; @@ -94,8 +91,9 @@ void Java_org_rocksdb_Options_disposeInternal( * Method: setIncreaseParallelism * Signature: (JI)V */ -void Java_org_rocksdb_Options_setIncreaseParallelism( - JNIEnv*, jobject, jlong jhandle, jint totalThreads) { +void Java_org_rocksdb_Options_setIncreaseParallelism(JNIEnv*, jobject, + jlong jhandle, + jint totalThreads) { reinterpret_cast(jhandle)->IncreaseParallelism( static_cast(totalThreads)); } @@ -105,8 +103,8 @@ void Java_org_rocksdb_Options_setIncreaseParallelism( * Method: setCreateIfMissing * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setCreateIfMissing( - JNIEnv*, jobject, jlong jhandle, jboolean flag) { +void Java_org_rocksdb_Options_setCreateIfMissing(JNIEnv*, jobject, + jlong jhandle, jboolean flag) { reinterpret_cast(jhandle)->create_if_missing = flag; } @@ -116,8 +114,8 @@ void Java_org_rocksdb_Options_setCreateIfMissing( * Method: createIfMissing * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_createIfMissing( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_createIfMissing(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->create_if_missing; } @@ -127,8 +125,9 @@ jboolean Java_org_rocksdb_Options_createIfMissing( * Method: setCreateMissingColumnFamilies * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setCreateMissingColumnFamilies( - JNIEnv*, jobject, jlong jhandle, jboolean flag) { +void Java_org_rocksdb_Options_setCreateMissingColumnFamilies(JNIEnv*, jobject, + jlong jhandle, + jboolean flag) { reinterpret_cast(jhandle) ->create_missing_column_families = flag; } @@ -138,8 +137,8 @@ void Java_org_rocksdb_Options_setCreateMissingColumnFamilies( * Method: createMissingColumnFamilies * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_createMissingColumnFamilies( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_createMissingColumnFamilies(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->create_missing_column_families; } @@ -149,8 +148,9 @@ jboolean Java_org_rocksdb_Options_createMissingColumnFamilies( * Method: setComparatorHandle * Signature: (JI)V */ -void Java_org_rocksdb_Options_setComparatorHandle__JI( - JNIEnv*, jobject, jlong jhandle, jint builtinComparator) { +void Java_org_rocksdb_Options_setComparatorHandle__JI(JNIEnv*, jobject, + jlong jhandle, + jint builtinComparator) { switch (builtinComparator) { case 1: reinterpret_cast(jhandle)->comparator = @@ -168,9 +168,10 @@ void Java_org_rocksdb_Options_setComparatorHandle__JI( * Method: setComparatorHandle * Signature: (JJB)V */ -void Java_org_rocksdb_Options_setComparatorHandle__JJB( - JNIEnv*, jobject, jlong jopt_handle, jlong jcomparator_handle, - jbyte jcomparator_type) { +void Java_org_rocksdb_Options_setComparatorHandle__JJB(JNIEnv*, jobject, + jlong jopt_handle, + jlong jcomparator_handle, + jbyte jcomparator_type) { ROCKSDB_NAMESPACE::Comparator* comparator = nullptr; switch (jcomparator_type) { // JAVA_COMPARATOR @@ -194,8 +195,9 @@ void Java_org_rocksdb_Options_setComparatorHandle__JJB( * Method: setMergeOperatorName * Signature: (JJjava/lang/String)V */ -void Java_org_rocksdb_Options_setMergeOperatorName( - JNIEnv* env, jobject, jlong jhandle, jstring jop_name) { +void Java_org_rocksdb_Options_setMergeOperatorName(JNIEnv* env, jobject, + jlong jhandle, + jstring jop_name) { const char* op_name = env->GetStringUTFChars(jop_name, nullptr); if (op_name == nullptr) { // exception thrown: OutOfMemoryError @@ -214,8 +216,8 @@ void Java_org_rocksdb_Options_setMergeOperatorName( * Method: setMergeOperator * Signature: (JJjava/lang/String)V */ -void Java_org_rocksdb_Options_setMergeOperator( - JNIEnv*, jobject, jlong jhandle, jlong mergeOperatorHandle) { +void Java_org_rocksdb_Options_setMergeOperator(JNIEnv*, jobject, jlong jhandle, + jlong mergeOperatorHandle) { reinterpret_cast(jhandle)->merge_operator = *(reinterpret_cast*>( mergeOperatorHandle)); @@ -227,8 +229,7 @@ void Java_org_rocksdb_Options_setMergeOperator( * Signature: (JJ)V */ void Java_org_rocksdb_Options_setCompactionFilterHandle( - JNIEnv*, jobject, jlong jopt_handle, - jlong jcompactionfilter_handle) { + JNIEnv*, jobject, jlong jopt_handle, jlong jcompactionfilter_handle) { reinterpret_cast(jopt_handle) ->compaction_filter = reinterpret_cast( @@ -255,8 +256,9 @@ void JNICALL Java_org_rocksdb_Options_setCompactionFilterFactoryHandle( * Method: setWriteBufferSize * Signature: (JJ)I */ -void Java_org_rocksdb_Options_setWriteBufferSize( - JNIEnv* env, jobject, jlong jhandle, jlong jwrite_buffer_size) { +void Java_org_rocksdb_Options_setWriteBufferSize(JNIEnv* env, jobject, + jlong jhandle, + jlong jwrite_buffer_size) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( jwrite_buffer_size); if (s.ok()) { @@ -287,8 +289,8 @@ void Java_org_rocksdb_Options_setWriteBufferManager( * Method: writeBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_writeBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_writeBufferSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->write_buffer_size; } @@ -299,8 +301,7 @@ jlong Java_org_rocksdb_Options_writeBufferSize( * Signature: (JI)V */ void Java_org_rocksdb_Options_setMaxWriteBufferNumber( - JNIEnv*, jobject, jlong jhandle, - jint jmax_write_buffer_number) { + JNIEnv*, jobject, jlong jhandle, jint jmax_write_buffer_number) { reinterpret_cast(jhandle) ->max_write_buffer_number = jmax_write_buffer_number; } @@ -310,8 +311,8 @@ void Java_org_rocksdb_Options_setMaxWriteBufferNumber( * Method: setStatistics * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setStatistics( - JNIEnv*, jobject, jlong jhandle, jlong jstatistics_handle) { +void Java_org_rocksdb_Options_setStatistics(JNIEnv*, jobject, jlong jhandle, + jlong jstatistics_handle) { auto* opt = reinterpret_cast(jhandle); auto* pSptr = reinterpret_cast*>( @@ -324,8 +325,7 @@ void Java_org_rocksdb_Options_setStatistics( * Method: statistics * Signature: (J)J */ -jlong Java_org_rocksdb_Options_statistics( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_statistics(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); std::shared_ptr sptr = opt->statistics; if (sptr == nullptr) { @@ -342,8 +342,8 @@ jlong Java_org_rocksdb_Options_statistics( * Method: maxWriteBufferNumber * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxWriteBufferNumber( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxWriteBufferNumber(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_write_buffer_number; } @@ -353,8 +353,8 @@ jint Java_org_rocksdb_Options_maxWriteBufferNumber( * Method: errorIfExists * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_errorIfExists( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_errorIfExists(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->error_if_exists; } @@ -364,8 +364,8 @@ jboolean Java_org_rocksdb_Options_errorIfExists( * Method: setErrorIfExists * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setErrorIfExists( - JNIEnv*, jobject, jlong jhandle, jboolean error_if_exists) { +void Java_org_rocksdb_Options_setErrorIfExists(JNIEnv*, jobject, jlong jhandle, + jboolean error_if_exists) { reinterpret_cast(jhandle)->error_if_exists = static_cast(error_if_exists); } @@ -375,8 +375,8 @@ void Java_org_rocksdb_Options_setErrorIfExists( * Method: paranoidChecks * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_paranoidChecks( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_paranoidChecks(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->paranoid_checks; } @@ -386,8 +386,8 @@ jboolean Java_org_rocksdb_Options_paranoidChecks( * Method: setParanoidChecks * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setParanoidChecks( - JNIEnv*, jobject, jlong jhandle, jboolean paranoid_checks) { +void Java_org_rocksdb_Options_setParanoidChecks(JNIEnv*, jobject, jlong jhandle, + jboolean paranoid_checks) { reinterpret_cast(jhandle)->paranoid_checks = static_cast(paranoid_checks); } @@ -397,8 +397,8 @@ void Java_org_rocksdb_Options_setParanoidChecks( * Method: setEnv * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setEnv( - JNIEnv*, jobject, jlong jhandle, jlong jenv) { +void Java_org_rocksdb_Options_setEnv(JNIEnv*, jobject, jlong jhandle, + jlong jenv) { reinterpret_cast(jhandle)->env = reinterpret_cast(jenv); } @@ -408,8 +408,9 @@ void Java_org_rocksdb_Options_setEnv( * Method: setMaxTotalWalSize * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setMaxTotalWalSize( - JNIEnv*, jobject, jlong jhandle, jlong jmax_total_wal_size) { +void Java_org_rocksdb_Options_setMaxTotalWalSize(JNIEnv*, jobject, + jlong jhandle, + jlong jmax_total_wal_size) { reinterpret_cast(jhandle)->max_total_wal_size = static_cast(jmax_total_wal_size); } @@ -419,8 +420,8 @@ void Java_org_rocksdb_Options_setMaxTotalWalSize( * Method: maxTotalWalSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxTotalWalSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxTotalWalSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_total_wal_size; } @@ -430,8 +431,7 @@ jlong Java_org_rocksdb_Options_maxTotalWalSize( * Method: maxOpenFiles * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxOpenFiles( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxOpenFiles(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->max_open_files; } @@ -440,8 +440,8 @@ jint Java_org_rocksdb_Options_maxOpenFiles( * Method: setMaxOpenFiles * Signature: (JI)V */ -void Java_org_rocksdb_Options_setMaxOpenFiles( - JNIEnv*, jobject, jlong jhandle, jint max_open_files) { +void Java_org_rocksdb_Options_setMaxOpenFiles(JNIEnv*, jobject, jlong jhandle, + jint max_open_files) { reinterpret_cast(jhandle)->max_open_files = static_cast(max_open_files); } @@ -462,8 +462,8 @@ void Java_org_rocksdb_Options_setMaxFileOpeningThreads( * Method: maxFileOpeningThreads * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxFileOpeningThreads( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxFileOpeningThreads(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_file_opening_threads); } @@ -473,8 +473,7 @@ jint Java_org_rocksdb_Options_maxFileOpeningThreads( * Method: useFsync * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_useFsync( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_useFsync(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->use_fsync; } @@ -483,8 +482,8 @@ jboolean Java_org_rocksdb_Options_useFsync( * Method: setUseFsync * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setUseFsync( - JNIEnv*, jobject, jlong jhandle, jboolean use_fsync) { +void Java_org_rocksdb_Options_setUseFsync(JNIEnv*, jobject, jlong jhandle, + jboolean use_fsync) { reinterpret_cast(jhandle)->use_fsync = static_cast(use_fsync); } @@ -494,9 +493,9 @@ void Java_org_rocksdb_Options_setUseFsync( * Method: setDbPaths * Signature: (J[Ljava/lang/String;[J)V */ -void Java_org_rocksdb_Options_setDbPaths( - JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths, - jlongArray jtarget_sizes) { +void Java_org_rocksdb_Options_setDbPaths(JNIEnv* env, jobject, jlong jhandle, + jobjectArray jpaths, + jlongArray jtarget_sizes) { std::vector db_paths; jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr); if (ptr_jtarget_size == nullptr) { @@ -540,8 +539,7 @@ void Java_org_rocksdb_Options_setDbPaths( * Method: dbPathsLen * Signature: (J)J */ -jlong Java_org_rocksdb_Options_dbPathsLen( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_dbPathsLen(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_paths.size()); } @@ -551,9 +549,9 @@ jlong Java_org_rocksdb_Options_dbPathsLen( * Method: dbPaths * Signature: (J[Ljava/lang/String;[J)V */ -void Java_org_rocksdb_Options_dbPaths( - JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths, - jlongArray jtarget_sizes) { +void Java_org_rocksdb_Options_dbPaths(JNIEnv* env, jobject, jlong jhandle, + jobjectArray jpaths, + jlongArray jtarget_sizes) { jboolean is_copy; jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, &is_copy); if (ptr_jtarget_size == nullptr) { @@ -592,8 +590,7 @@ void Java_org_rocksdb_Options_dbPaths( * Method: dbLogDir * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_Options_dbLogDir( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_Options_dbLogDir(JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( reinterpret_cast(jhandle) ->db_log_dir.c_str()); @@ -604,8 +601,8 @@ jstring Java_org_rocksdb_Options_dbLogDir( * Method: setDbLogDir * Signature: (JLjava/lang/String)V */ -void Java_org_rocksdb_Options_setDbLogDir( - JNIEnv* env, jobject, jlong jhandle, jstring jdb_log_dir) { +void Java_org_rocksdb_Options_setDbLogDir(JNIEnv* env, jobject, jlong jhandle, + jstring jdb_log_dir) { const char* log_dir = env->GetStringUTFChars(jdb_log_dir, nullptr); if (log_dir == nullptr) { // exception thrown: OutOfMemoryError @@ -621,8 +618,7 @@ void Java_org_rocksdb_Options_setDbLogDir( * Method: walDir * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_Options_walDir( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_Options_walDir(JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( reinterpret_cast(jhandle)->wal_dir.c_str()); } @@ -632,8 +628,8 @@ jstring Java_org_rocksdb_Options_walDir( * Method: setWalDir * Signature: (JLjava/lang/String)V */ -void Java_org_rocksdb_Options_setWalDir( - JNIEnv* env, jobject, jlong jhandle, jstring jwal_dir) { +void Java_org_rocksdb_Options_setWalDir(JNIEnv* env, jobject, jlong jhandle, + jstring jwal_dir) { const char* wal_dir = env->GetStringUTFChars(jwal_dir, nullptr); if (wal_dir == nullptr) { // exception thrown: OutOfMemoryError @@ -649,8 +645,8 @@ void Java_org_rocksdb_Options_setWalDir( * Method: deleteObsoleteFilesPeriodMicros * Signature: (J)J */ -jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros; } @@ -660,8 +656,10 @@ jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros( * Method: setDeleteObsoleteFilesPeriodMicros * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros( - JNIEnv*, jobject, jlong jhandle, jlong micros) { +void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros(JNIEnv*, + jobject, + jlong jhandle, + jlong micros) { reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros = static_cast(micros); } @@ -671,8 +669,8 @@ void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros( * Method: maxBackgroundCompactions * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxBackgroundCompactions( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxBackgroundCompactions(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_background_compactions; } @@ -682,8 +680,9 @@ jint Java_org_rocksdb_Options_maxBackgroundCompactions( * Method: setMaxBackgroundCompactions * Signature: (JI)V */ -void Java_org_rocksdb_Options_setMaxBackgroundCompactions( - JNIEnv*, jobject, jlong jhandle, jint max) { +void Java_org_rocksdb_Options_setMaxBackgroundCompactions(JNIEnv*, jobject, + jlong jhandle, + jint max) { reinterpret_cast(jhandle) ->max_background_compactions = static_cast(max); } @@ -693,8 +692,8 @@ void Java_org_rocksdb_Options_setMaxBackgroundCompactions( * Method: setMaxSubcompactions * Signature: (JI)V */ -void Java_org_rocksdb_Options_setMaxSubcompactions( - JNIEnv*, jobject, jlong jhandle, jint max) { +void Java_org_rocksdb_Options_setMaxSubcompactions(JNIEnv*, jobject, + jlong jhandle, jint max) { reinterpret_cast(jhandle)->max_subcompactions = static_cast(max); } @@ -704,8 +703,8 @@ void Java_org_rocksdb_Options_setMaxSubcompactions( * Method: maxSubcompactions * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxSubcompactions( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxSubcompactions(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_subcompactions; } @@ -715,8 +714,8 @@ jint Java_org_rocksdb_Options_maxSubcompactions( * Method: maxBackgroundFlushes * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxBackgroundFlushes( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxBackgroundFlushes(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_background_flushes; } @@ -737,8 +736,8 @@ void Java_org_rocksdb_Options_setMaxBackgroundFlushes( * Method: maxBackgroundJobs * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxBackgroundJobs( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxBackgroundJobs(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_background_jobs; } @@ -748,8 +747,9 @@ jint Java_org_rocksdb_Options_maxBackgroundJobs( * Method: setMaxBackgroundJobs * Signature: (JI)V */ -void Java_org_rocksdb_Options_setMaxBackgroundJobs( - JNIEnv*, jobject, jlong jhandle, jint max_background_jobs) { +void Java_org_rocksdb_Options_setMaxBackgroundJobs(JNIEnv*, jobject, + jlong jhandle, + jint max_background_jobs) { reinterpret_cast(jhandle)->max_background_jobs = static_cast(max_background_jobs); } @@ -759,8 +759,7 @@ void Java_org_rocksdb_Options_setMaxBackgroundJobs( * Method: maxLogFileSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxLogFileSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxLogFileSize(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->max_log_file_size; } @@ -770,8 +769,9 @@ jlong Java_org_rocksdb_Options_maxLogFileSize( * Method: setMaxLogFileSize * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setMaxLogFileSize( - JNIEnv* env, jobject, jlong jhandle, jlong max_log_file_size) { +void Java_org_rocksdb_Options_setMaxLogFileSize(JNIEnv* env, jobject, + jlong jhandle, + jlong max_log_file_size) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(max_log_file_size); if (s.ok()) { @@ -787,8 +787,8 @@ void Java_org_rocksdb_Options_setMaxLogFileSize( * Method: logFileTimeToRoll * Signature: (J)J */ -jlong Java_org_rocksdb_Options_logFileTimeToRoll( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_logFileTimeToRoll(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->log_file_time_to_roll; } @@ -815,8 +815,7 @@ void Java_org_rocksdb_Options_setLogFileTimeToRoll( * Method: keepLogFileNum * Signature: (J)J */ -jlong Java_org_rocksdb_Options_keepLogFileNum( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_keepLogFileNum(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->keep_log_file_num; } @@ -826,8 +825,9 @@ jlong Java_org_rocksdb_Options_keepLogFileNum( * Method: setKeepLogFileNum * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setKeepLogFileNum( - JNIEnv* env, jobject, jlong jhandle, jlong keep_log_file_num) { +void Java_org_rocksdb_Options_setKeepLogFileNum(JNIEnv* env, jobject, + jlong jhandle, + jlong keep_log_file_num) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num); if (s.ok()) { @@ -843,8 +843,8 @@ void Java_org_rocksdb_Options_setKeepLogFileNum( * Method: recycleLogFileNum * Signature: (J)J */ -jlong Java_org_rocksdb_Options_recycleLogFileNum( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_recycleLogFileNum(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->recycle_log_file_num; } @@ -854,8 +854,9 @@ jlong Java_org_rocksdb_Options_recycleLogFileNum( * Method: setRecycleLogFileNum * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setRecycleLogFileNum( - JNIEnv* env, jobject, jlong jhandle, jlong recycle_log_file_num) { +void Java_org_rocksdb_Options_setRecycleLogFileNum(JNIEnv* env, jobject, + jlong jhandle, + jlong recycle_log_file_num) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t( recycle_log_file_num); if (s.ok()) { @@ -871,8 +872,8 @@ void Java_org_rocksdb_Options_setRecycleLogFileNum( * Method: maxManifestFileSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxManifestFileSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxManifestFileSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_manifest_file_size; } @@ -881,8 +882,8 @@ jlong Java_org_rocksdb_Options_maxManifestFileSize( * Method: memTableFactoryName * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_Options_memTableFactoryName( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_Options_memTableFactoryName(JNIEnv* env, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); ROCKSDB_NAMESPACE::MemTableRepFactory* tf = opt->memtable_factory.get(); @@ -1042,8 +1043,9 @@ void Java_org_rocksdb_Options_setMaxManifestFileSize( * Method: setMemTableFactory * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setMemTableFactory( - JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) { +void Java_org_rocksdb_Options_setMemTableFactory(JNIEnv*, jobject, + jlong jhandle, + jlong jfactory_handle) { reinterpret_cast(jhandle) ->memtable_factory.reset( reinterpret_cast( @@ -1055,8 +1057,8 @@ void Java_org_rocksdb_Options_setMemTableFactory( * Method: setRateLimiter * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setRateLimiter( - JNIEnv*, jobject, jlong jhandle, jlong jrate_limiter_handle) { +void Java_org_rocksdb_Options_setRateLimiter(JNIEnv*, jobject, jlong jhandle, + jlong jrate_limiter_handle) { std::shared_ptr* pRateLimiter = reinterpret_cast*>( jrate_limiter_handle); @@ -1083,8 +1085,8 @@ void Java_org_rocksdb_Options_setSstFileManager( * Method: setLogger * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setLogger( - JNIEnv*, jobject, jlong jhandle, jlong jlogger_handle) { +void Java_org_rocksdb_Options_setLogger(JNIEnv*, jobject, jlong jhandle, + jlong jlogger_handle) { std::shared_ptr* pLogger = reinterpret_cast*>( jlogger_handle); @@ -1096,8 +1098,8 @@ void Java_org_rocksdb_Options_setLogger( * Method: setInfoLogLevel * Signature: (JB)V */ -void Java_org_rocksdb_Options_setInfoLogLevel( - JNIEnv*, jobject, jlong jhandle, jbyte jlog_level) { +void Java_org_rocksdb_Options_setInfoLogLevel(JNIEnv*, jobject, jlong jhandle, + jbyte jlog_level) { reinterpret_cast(jhandle)->info_log_level = static_cast(jlog_level); } @@ -1107,8 +1109,7 @@ void Java_org_rocksdb_Options_setInfoLogLevel( * Method: infoLogLevel * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_infoLogLevel( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_infoLogLevel(JNIEnv*, jobject, jlong jhandle) { return static_cast( reinterpret_cast(jhandle)->info_log_level); } @@ -1118,8 +1119,8 @@ jbyte Java_org_rocksdb_Options_infoLogLevel( * Method: tableCacheNumshardbits * Signature: (J)I */ -jint Java_org_rocksdb_Options_tableCacheNumshardbits( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_tableCacheNumshardbits(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->table_cache_numshardbits; } @@ -1150,8 +1151,9 @@ void Java_org_rocksdb_Options_useFixedLengthPrefixExtractor( * Method: useCappedPrefixExtractor * Signature: (JI)V */ -void Java_org_rocksdb_Options_useCappedPrefixExtractor( - JNIEnv*, jobject, jlong jhandle, jint jprefix_length) { +void Java_org_rocksdb_Options_useCappedPrefixExtractor(JNIEnv*, jobject, + jlong jhandle, + jint jprefix_length) { reinterpret_cast(jhandle) ->prefix_extractor.reset(ROCKSDB_NAMESPACE::NewCappedPrefixTransform( static_cast(jprefix_length))); @@ -1162,8 +1164,7 @@ void Java_org_rocksdb_Options_useCappedPrefixExtractor( * Method: walTtlSeconds * Signature: (J)J */ -jlong Java_org_rocksdb_Options_walTtlSeconds( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_walTtlSeconds(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->WAL_ttl_seconds; } @@ -1173,8 +1174,8 @@ jlong Java_org_rocksdb_Options_walTtlSeconds( * Method: setWalTtlSeconds * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setWalTtlSeconds( - JNIEnv*, jobject, jlong jhandle, jlong WAL_ttl_seconds) { +void Java_org_rocksdb_Options_setWalTtlSeconds(JNIEnv*, jobject, jlong jhandle, + jlong WAL_ttl_seconds) { reinterpret_cast(jhandle)->WAL_ttl_seconds = static_cast(WAL_ttl_seconds); } @@ -1184,8 +1185,7 @@ void Java_org_rocksdb_Options_setWalTtlSeconds( * Method: walTtlSeconds * Signature: (J)J */ -jlong Java_org_rocksdb_Options_walSizeLimitMB( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_walSizeLimitMB(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->WAL_size_limit_MB; } @@ -1195,8 +1195,8 @@ jlong Java_org_rocksdb_Options_walSizeLimitMB( * Method: setWalSizeLimitMB * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setWalSizeLimitMB( - JNIEnv*, jobject, jlong jhandle, jlong WAL_size_limit_MB) { +void Java_org_rocksdb_Options_setWalSizeLimitMB(JNIEnv*, jobject, jlong jhandle, + jlong WAL_size_limit_MB) { reinterpret_cast(jhandle)->WAL_size_limit_MB = static_cast(WAL_size_limit_MB); } @@ -1229,8 +1229,8 @@ jlong Java_org_rocksdb_Options_maxWriteBatchGroupSizeBytes(JNIEnv*, jclass, * Method: manifestPreallocationSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_manifestPreallocationSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_manifestPreallocationSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->manifest_preallocation_size; } @@ -1256,8 +1256,8 @@ void Java_org_rocksdb_Options_setManifestPreallocationSize( * Method: setTableFactory * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setTableFactory( - JNIEnv*, jobject, jlong jhandle, jlong jtable_factory_handle) { +void Java_org_rocksdb_Options_setTableFactory(JNIEnv*, jobject, jlong jhandle, + jlong jtable_factory_handle) { auto* options = reinterpret_cast(jhandle); auto* table_factory = reinterpret_cast(jtable_factory_handle); @@ -1297,8 +1297,8 @@ void Java_org_rocksdb_Options_setCompactionThreadLimiter( * Method: allowMmapReads * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_allowMmapReads( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_allowMmapReads(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->allow_mmap_reads; } @@ -1308,8 +1308,8 @@ jboolean Java_org_rocksdb_Options_allowMmapReads( * Method: setAllowMmapReads * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setAllowMmapReads( - JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_reads) { +void Java_org_rocksdb_Options_setAllowMmapReads(JNIEnv*, jobject, jlong jhandle, + jboolean allow_mmap_reads) { reinterpret_cast(jhandle)->allow_mmap_reads = static_cast(allow_mmap_reads); } @@ -1319,8 +1319,8 @@ void Java_org_rocksdb_Options_setAllowMmapReads( * Method: allowMmapWrites * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_allowMmapWrites( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_allowMmapWrites(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->allow_mmap_writes; } @@ -1330,8 +1330,9 @@ jboolean Java_org_rocksdb_Options_allowMmapWrites( * Method: setAllowMmapWrites * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setAllowMmapWrites( - JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_writes) { +void Java_org_rocksdb_Options_setAllowMmapWrites(JNIEnv*, jobject, + jlong jhandle, + jboolean allow_mmap_writes) { reinterpret_cast(jhandle)->allow_mmap_writes = static_cast(allow_mmap_writes); } @@ -1341,8 +1342,8 @@ void Java_org_rocksdb_Options_setAllowMmapWrites( * Method: useDirectReads * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_useDirectReads( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_useDirectReads(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->use_direct_reads; } @@ -1352,8 +1353,8 @@ jboolean Java_org_rocksdb_Options_useDirectReads( * Method: setUseDirectReads * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setUseDirectReads( - JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) { +void Java_org_rocksdb_Options_setUseDirectReads(JNIEnv*, jobject, jlong jhandle, + jboolean use_direct_reads) { reinterpret_cast(jhandle)->use_direct_reads = static_cast(use_direct_reads); } @@ -1387,8 +1388,8 @@ void Java_org_rocksdb_Options_setUseDirectIoForFlushAndCompaction( * Method: setAllowFAllocate * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setAllowFAllocate( - JNIEnv*, jobject, jlong jhandle, jboolean jallow_fallocate) { +void Java_org_rocksdb_Options_setAllowFAllocate(JNIEnv*, jobject, jlong jhandle, + jboolean jallow_fallocate) { reinterpret_cast(jhandle)->allow_fallocate = static_cast(jallow_fallocate); } @@ -1398,8 +1399,8 @@ void Java_org_rocksdb_Options_setAllowFAllocate( * Method: allowFAllocate * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_allowFAllocate( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_allowFAllocate(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_fallocate); } @@ -1409,8 +1410,8 @@ jboolean Java_org_rocksdb_Options_allowFAllocate( * Method: isFdCloseOnExec * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_isFdCloseOnExec( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_isFdCloseOnExec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->is_fd_close_on_exec; } @@ -1420,8 +1421,9 @@ jboolean Java_org_rocksdb_Options_isFdCloseOnExec( * Method: setIsFdCloseOnExec * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setIsFdCloseOnExec( - JNIEnv*, jobject, jlong jhandle, jboolean is_fd_close_on_exec) { +void Java_org_rocksdb_Options_setIsFdCloseOnExec(JNIEnv*, jobject, + jlong jhandle, + jboolean is_fd_close_on_exec) { reinterpret_cast(jhandle)->is_fd_close_on_exec = static_cast(is_fd_close_on_exec); } @@ -1431,8 +1433,8 @@ void Java_org_rocksdb_Options_setIsFdCloseOnExec( * Method: statsDumpPeriodSec * Signature: (J)I */ -jint Java_org_rocksdb_Options_statsDumpPeriodSec( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_statsDumpPeriodSec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->stats_dump_period_sec; } @@ -1443,8 +1445,7 @@ jint Java_org_rocksdb_Options_statsDumpPeriodSec( * Signature: (JI)V */ void Java_org_rocksdb_Options_setStatsDumpPeriodSec( - JNIEnv*, jobject, jlong jhandle, - jint jstats_dump_period_sec) { + JNIEnv*, jobject, jlong jhandle, jint jstats_dump_period_sec) { reinterpret_cast(jhandle) ->stats_dump_period_sec = static_cast(jstats_dump_period_sec); @@ -1455,8 +1456,8 @@ void Java_org_rocksdb_Options_setStatsDumpPeriodSec( * Method: statsPersistPeriodSec * Signature: (J)I */ -jint Java_org_rocksdb_Options_statsPersistPeriodSec( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_statsPersistPeriodSec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->stats_persist_period_sec; } @@ -1478,8 +1479,8 @@ void Java_org_rocksdb_Options_setStatsPersistPeriodSec( * Method: statsHistoryBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_statsHistoryBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_statsHistoryBufferSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->stats_history_buffer_size; } @@ -1501,8 +1502,8 @@ void Java_org_rocksdb_Options_setStatsHistoryBufferSize( * Method: adviseRandomOnOpen * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_adviseRandomOnOpen( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_adviseRandomOnOpen(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->advise_random_on_open; } @@ -1513,8 +1514,7 @@ jboolean Java_org_rocksdb_Options_adviseRandomOnOpen( * Signature: (JZ)V */ void Java_org_rocksdb_Options_setAdviseRandomOnOpen( - JNIEnv*, jobject, jlong jhandle, - jboolean advise_random_on_open) { + JNIEnv*, jobject, jlong jhandle, jboolean advise_random_on_open) { reinterpret_cast(jhandle) ->advise_random_on_open = static_cast(advise_random_on_open); } @@ -1525,8 +1525,7 @@ void Java_org_rocksdb_Options_setAdviseRandomOnOpen( * Signature: (JJ)V */ void Java_org_rocksdb_Options_setDbWriteBufferSize( - JNIEnv*, jobject, jlong jhandle, - jlong jdb_write_buffer_size) { + JNIEnv*, jobject, jlong jhandle, jlong jdb_write_buffer_size) { auto* opt = reinterpret_cast(jhandle); opt->db_write_buffer_size = static_cast(jdb_write_buffer_size); } @@ -1536,8 +1535,8 @@ void Java_org_rocksdb_Options_setDbWriteBufferSize( * Method: dbWriteBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_dbWriteBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_dbWriteBufferSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_write_buffer_size); } @@ -1548,8 +1547,7 @@ jlong Java_org_rocksdb_Options_dbWriteBufferSize( * Signature: (JB)V */ void Java_org_rocksdb_Options_setAccessHintOnCompactionStart( - JNIEnv*, jobject, jlong jhandle, - jbyte jaccess_hint_value) { + JNIEnv*, jobject, jlong jhandle, jbyte jaccess_hint_value) { auto* opt = reinterpret_cast(jhandle); opt->access_hint_on_compaction_start = ROCKSDB_NAMESPACE::AccessHintJni::toCppAccessHint(jaccess_hint_value); @@ -1560,8 +1558,8 @@ void Java_org_rocksdb_Options_setAccessHintOnCompactionStart( * Method: accessHintOnCompactionStart * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_accessHintOnCompactionStart( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_accessHintOnCompactionStart(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::AccessHintJni::toJavaAccessHint( opt->access_hint_on_compaction_start); @@ -1573,8 +1571,7 @@ jbyte Java_org_rocksdb_Options_accessHintOnCompactionStart( * Signature: (JJ)V */ void Java_org_rocksdb_Options_setCompactionReadaheadSize( - JNIEnv*, jobject, jlong jhandle, - jlong jcompaction_readahead_size) { + JNIEnv*, jobject, jlong jhandle, jlong jcompaction_readahead_size) { auto* opt = reinterpret_cast(jhandle); opt->compaction_readahead_size = static_cast(jcompaction_readahead_size); @@ -1585,8 +1582,8 @@ void Java_org_rocksdb_Options_setCompactionReadaheadSize( * Method: compactionReadaheadSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_compactionReadaheadSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_compactionReadaheadSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->compaction_readahead_size); } @@ -1608,8 +1605,8 @@ void Java_org_rocksdb_Options_setRandomAccessMaxBufferSize( * Method: randomAccessMaxBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->random_access_max_buffer_size); } @@ -1620,8 +1617,7 @@ jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize( * Signature: (JJ)V */ void Java_org_rocksdb_Options_setWritableFileMaxBufferSize( - JNIEnv*, jobject, jlong jhandle, - jlong jwritable_file_max_buffer_size) { + JNIEnv*, jobject, jlong jhandle, jlong jwritable_file_max_buffer_size) { auto* opt = reinterpret_cast(jhandle); opt->writable_file_max_buffer_size = static_cast(jwritable_file_max_buffer_size); @@ -1632,8 +1628,8 @@ void Java_org_rocksdb_Options_setWritableFileMaxBufferSize( * Method: writableFileMaxBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_writableFileMaxBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_writableFileMaxBufferSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->writable_file_max_buffer_size); } @@ -1643,8 +1639,8 @@ jlong Java_org_rocksdb_Options_writableFileMaxBufferSize( * Method: useAdaptiveMutex * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_useAdaptiveMutex( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_useAdaptiveMutex(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->use_adaptive_mutex; } @@ -1654,8 +1650,9 @@ jboolean Java_org_rocksdb_Options_useAdaptiveMutex( * Method: setUseAdaptiveMutex * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setUseAdaptiveMutex( - JNIEnv*, jobject, jlong jhandle, jboolean use_adaptive_mutex) { +void Java_org_rocksdb_Options_setUseAdaptiveMutex(JNIEnv*, jobject, + jlong jhandle, + jboolean use_adaptive_mutex) { reinterpret_cast(jhandle)->use_adaptive_mutex = static_cast(use_adaptive_mutex); } @@ -1665,8 +1662,7 @@ void Java_org_rocksdb_Options_setUseAdaptiveMutex( * Method: bytesPerSync * Signature: (J)J */ -jlong Java_org_rocksdb_Options_bytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_bytesPerSync(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->bytes_per_sync; } @@ -1675,8 +1671,8 @@ jlong Java_org_rocksdb_Options_bytesPerSync( * Method: setBytesPerSync * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setBytesPerSync( - JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) { +void Java_org_rocksdb_Options_setBytesPerSync(JNIEnv*, jobject, jlong jhandle, + jlong bytes_per_sync) { reinterpret_cast(jhandle)->bytes_per_sync = static_cast(bytes_per_sync); } @@ -1686,8 +1682,9 @@ void Java_org_rocksdb_Options_setBytesPerSync( * Method: setWalBytesPerSync * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setWalBytesPerSync( - JNIEnv*, jobject, jlong jhandle, jlong jwal_bytes_per_sync) { +void Java_org_rocksdb_Options_setWalBytesPerSync(JNIEnv*, jobject, + jlong jhandle, + jlong jwal_bytes_per_sync) { reinterpret_cast(jhandle)->wal_bytes_per_sync = static_cast(jwal_bytes_per_sync); } @@ -1697,8 +1694,8 @@ void Java_org_rocksdb_Options_setWalBytesPerSync( * Method: walBytesPerSync * Signature: (J)J */ -jlong Java_org_rocksdb_Options_walBytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_walBytesPerSync(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->wal_bytes_per_sync); } @@ -1719,8 +1716,8 @@ void Java_org_rocksdb_Options_setStrictBytesPerSync( * Method: strictBytesPerSync * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_strictBytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_strictBytesPerSync(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->strict_bytes_per_sync); } @@ -1811,8 +1808,8 @@ void Java_org_rocksdb_Options_setEnableThreadTracking( * Method: enableThreadTracking * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_enableThreadTracking( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_enableThreadTracking(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_thread_tracking); } @@ -1822,8 +1819,9 @@ jboolean Java_org_rocksdb_Options_enableThreadTracking( * Method: setDelayedWriteRate * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setDelayedWriteRate( - JNIEnv*, jobject, jlong jhandle, jlong jdelayed_write_rate) { +void Java_org_rocksdb_Options_setDelayedWriteRate(JNIEnv*, jobject, + jlong jhandle, + jlong jdelayed_write_rate) { auto* opt = reinterpret_cast(jhandle); opt->delayed_write_rate = static_cast(jdelayed_write_rate); } @@ -1833,8 +1831,8 @@ void Java_org_rocksdb_Options_setDelayedWriteRate( * Method: delayedWriteRate * Signature: (J)J */ -jlong Java_org_rocksdb_Options_delayedWriteRate( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_delayedWriteRate(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->delayed_write_rate); } @@ -1855,8 +1853,8 @@ void Java_org_rocksdb_Options_setEnablePipelinedWrite( * Method: enablePipelinedWrite * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_enablePipelinedWrite( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_enablePipelinedWrite(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_pipelined_write); } @@ -1866,8 +1864,8 @@ jboolean Java_org_rocksdb_Options_enablePipelinedWrite( * Method: setUnorderedWrite * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setUnorderedWrite( - JNIEnv*, jobject, jlong jhandle, jboolean unordered_write) { +void Java_org_rocksdb_Options_setUnorderedWrite(JNIEnv*, jobject, jlong jhandle, + jboolean unordered_write) { reinterpret_cast(jhandle)->unordered_write = static_cast(unordered_write); } @@ -1877,8 +1875,8 @@ void Java_org_rocksdb_Options_setUnorderedWrite( * Method: unorderedWrite * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_unorderedWrite( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_unorderedWrite(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->unordered_write; } @@ -1888,8 +1886,9 @@ jboolean Java_org_rocksdb_Options_unorderedWrite( * Method: setAllowConcurrentMemtableWrite * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setAllowConcurrentMemtableWrite( - JNIEnv*, jobject, jlong jhandle, jboolean allow) { +void Java_org_rocksdb_Options_setAllowConcurrentMemtableWrite(JNIEnv*, jobject, + jlong jhandle, + jboolean allow) { reinterpret_cast(jhandle) ->allow_concurrent_memtable_write = static_cast(allow); } @@ -1899,8 +1898,8 @@ void Java_org_rocksdb_Options_setAllowConcurrentMemtableWrite( * Method: allowConcurrentMemtableWrite * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_allowConcurrentMemtableWrite( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_allowConcurrentMemtableWrite(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->allow_concurrent_memtable_write; } @@ -1932,8 +1931,9 @@ jboolean Java_org_rocksdb_Options_enableWriteThreadAdaptiveYield( * Method: setWriteThreadMaxYieldUsec * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setWriteThreadMaxYieldUsec( - JNIEnv*, jobject, jlong jhandle, jlong max) { +void Java_org_rocksdb_Options_setWriteThreadMaxYieldUsec(JNIEnv*, jobject, + jlong jhandle, + jlong max) { reinterpret_cast(jhandle) ->write_thread_max_yield_usec = static_cast(max); } @@ -1943,8 +1943,8 @@ void Java_org_rocksdb_Options_setWriteThreadMaxYieldUsec( * Method: writeThreadMaxYieldUsec * Signature: (J)J */ -jlong Java_org_rocksdb_Options_writeThreadMaxYieldUsec( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_writeThreadMaxYieldUsec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->write_thread_max_yield_usec; } @@ -1954,8 +1954,9 @@ jlong Java_org_rocksdb_Options_writeThreadMaxYieldUsec( * Method: setWriteThreadSlowYieldUsec * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setWriteThreadSlowYieldUsec( - JNIEnv*, jobject, jlong jhandle, jlong slow) { +void Java_org_rocksdb_Options_setWriteThreadSlowYieldUsec(JNIEnv*, jobject, + jlong jhandle, + jlong slow) { reinterpret_cast(jhandle) ->write_thread_slow_yield_usec = static_cast(slow); } @@ -1965,8 +1966,8 @@ void Java_org_rocksdb_Options_setWriteThreadSlowYieldUsec( * Method: writeThreadSlowYieldUsec * Signature: (J)J */ -jlong Java_org_rocksdb_Options_writeThreadSlowYieldUsec( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_writeThreadSlowYieldUsec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->write_thread_slow_yield_usec; } @@ -1977,8 +1978,7 @@ jlong Java_org_rocksdb_Options_writeThreadSlowYieldUsec( * Signature: (JZ)V */ void Java_org_rocksdb_Options_setSkipStatsUpdateOnDbOpen( - JNIEnv*, jobject, jlong jhandle, - jboolean jskip_stats_update_on_db_open) { + JNIEnv*, jobject, jlong jhandle, jboolean jskip_stats_update_on_db_open) { auto* opt = reinterpret_cast(jhandle); opt->skip_stats_update_on_db_open = static_cast(jskip_stats_update_on_db_open); @@ -1989,8 +1989,8 @@ void Java_org_rocksdb_Options_setSkipStatsUpdateOnDbOpen( * Method: skipStatsUpdateOnDbOpen * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_skipStatsUpdateOnDbOpen( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_skipStatsUpdateOnDbOpen(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->skip_stats_update_on_db_open); } @@ -2025,8 +2025,7 @@ jboolean Java_org_rocksdb_Options_skipCheckingSstFileSizesOnDbOpen( * Signature: (JB)V */ void Java_org_rocksdb_Options_setWalRecoveryMode( - JNIEnv*, jobject, jlong jhandle, - jbyte jwal_recovery_mode_value) { + JNIEnv*, jobject, jlong jhandle, jbyte jwal_recovery_mode_value) { auto* opt = reinterpret_cast(jhandle); opt->wal_recovery_mode = ROCKSDB_NAMESPACE::WALRecoveryModeJni::toCppWALRecoveryMode( @@ -2038,8 +2037,8 @@ void Java_org_rocksdb_Options_setWalRecoveryMode( * Method: walRecoveryMode * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_walRecoveryMode( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_walRecoveryMode(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::WALRecoveryModeJni::toJavaWALRecoveryMode( opt->wal_recovery_mode); @@ -2050,8 +2049,8 @@ jbyte Java_org_rocksdb_Options_walRecoveryMode( * Method: setAllow2pc * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setAllow2pc( - JNIEnv*, jobject, jlong jhandle, jboolean jallow_2pc) { +void Java_org_rocksdb_Options_setAllow2pc(JNIEnv*, jobject, jlong jhandle, + jboolean jallow_2pc) { auto* opt = reinterpret_cast(jhandle); opt->allow_2pc = static_cast(jallow_2pc); } @@ -2061,8 +2060,7 @@ void Java_org_rocksdb_Options_setAllow2pc( * Method: allow2pc * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_allow2pc( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_allow2pc(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_2pc); } @@ -2072,8 +2070,8 @@ jboolean Java_org_rocksdb_Options_allow2pc( * Method: setRowCache * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setRowCache( - JNIEnv*, jobject, jlong jhandle, jlong jrow_cache_handle) { +void Java_org_rocksdb_Options_setRowCache(JNIEnv*, jobject, jlong jhandle, + jlong jrow_cache_handle) { auto* opt = reinterpret_cast(jhandle); auto* row_cache = reinterpret_cast*>( @@ -2081,14 +2079,13 @@ void Java_org_rocksdb_Options_setRowCache( opt->row_cache = *row_cache; } - /* * Class: org_rocksdb_Options * Method: setWalFilter * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setWalFilter( - JNIEnv*, jobject, jlong jhandle, jlong jwal_filter_handle) { +void Java_org_rocksdb_Options_setWalFilter(JNIEnv*, jobject, jlong jhandle, + jlong jwal_filter_handle) { auto* opt = reinterpret_cast(jhandle); auto* wal_filter = reinterpret_cast( jwal_filter_handle); @@ -2112,8 +2109,8 @@ void Java_org_rocksdb_Options_setFailIfOptionsFileError( * Method: failIfOptionsFileError * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_failIfOptionsFileError( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_failIfOptionsFileError(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->fail_if_options_file_error); } @@ -2123,8 +2120,9 @@ jboolean Java_org_rocksdb_Options_failIfOptionsFileError( * Method: setDumpMallocStats * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setDumpMallocStats( - JNIEnv*, jobject, jlong jhandle, jboolean jdump_malloc_stats) { +void Java_org_rocksdb_Options_setDumpMallocStats(JNIEnv*, jobject, + jlong jhandle, + jboolean jdump_malloc_stats) { auto* opt = reinterpret_cast(jhandle); opt->dump_malloc_stats = static_cast(jdump_malloc_stats); } @@ -2134,8 +2132,8 @@ void Java_org_rocksdb_Options_setDumpMallocStats( * Method: dumpMallocStats * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_dumpMallocStats( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_dumpMallocStats(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->dump_malloc_stats); } @@ -2157,8 +2155,8 @@ void Java_org_rocksdb_Options_setAvoidFlushDuringRecovery( * Method: avoidFlushDuringRecovery * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_avoidFlushDuringRecovery( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_avoidFlushDuringRecovery(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_recovery); } @@ -2336,8 +2334,8 @@ void Java_org_rocksdb_Options_setAvoidFlushDuringShutdown( * Method: avoidFlushDuringShutdown * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_avoidFlushDuringShutdown( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_avoidFlushDuringShutdown(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_shutdown); } @@ -2358,8 +2356,8 @@ void Java_org_rocksdb_Options_setAllowIngestBehind( * Method: allowIngestBehind * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_allowIngestBehind( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_allowIngestBehind(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_ingest_behind); } @@ -2369,8 +2367,8 @@ jboolean Java_org_rocksdb_Options_allowIngestBehind( * Method: setTwoWriteQueues * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setTwoWriteQueues( - JNIEnv*, jobject, jlong jhandle, jboolean jtwo_write_queues) { +void Java_org_rocksdb_Options_setTwoWriteQueues(JNIEnv*, jobject, jlong jhandle, + jboolean jtwo_write_queues) { auto* opt = reinterpret_cast(jhandle); opt->two_write_queues = jtwo_write_queues == JNI_TRUE; } @@ -2380,8 +2378,8 @@ void Java_org_rocksdb_Options_setTwoWriteQueues( * Method: twoWriteQueues * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_twoWriteQueues( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_twoWriteQueues(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->two_write_queues); } @@ -2391,8 +2389,8 @@ jboolean Java_org_rocksdb_Options_twoWriteQueues( * Method: setManualWalFlush * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setManualWalFlush( - JNIEnv*, jobject, jlong jhandle, jboolean jmanual_wal_flush) { +void Java_org_rocksdb_Options_setManualWalFlush(JNIEnv*, jobject, jlong jhandle, + jboolean jmanual_wal_flush) { auto* opt = reinterpret_cast(jhandle); opt->manual_wal_flush = jmanual_wal_flush == JNI_TRUE; } @@ -2402,8 +2400,8 @@ void Java_org_rocksdb_Options_setManualWalFlush( * Method: manualWalFlush * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_manualWalFlush( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_manualWalFlush(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->manual_wal_flush); } @@ -2413,8 +2411,8 @@ jboolean Java_org_rocksdb_Options_manualWalFlush( * Method: setAtomicFlush * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setAtomicFlush( - JNIEnv*, jobject, jlong jhandle, jboolean jatomic_flush) { +void Java_org_rocksdb_Options_setAtomicFlush(JNIEnv*, jobject, jlong jhandle, + jboolean jatomic_flush) { auto* opt = reinterpret_cast(jhandle); opt->atomic_flush = jatomic_flush == JNI_TRUE; } @@ -2424,8 +2422,7 @@ void Java_org_rocksdb_Options_setAtomicFlush( * Method: atomicFlush * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_atomicFlush( - JNIEnv *, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_atomicFlush(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->atomic_flush); } @@ -2434,8 +2431,8 @@ jboolean Java_org_rocksdb_Options_atomicFlush( * Method: tableFactoryName * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_Options_tableFactoryName( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_Options_tableFactoryName(JNIEnv* env, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); ROCKSDB_NAMESPACE::TableFactory* tf = opt->table_factory.get(); @@ -2451,8 +2448,8 @@ jstring Java_org_rocksdb_Options_tableFactoryName( * Method: minWriteBufferNumberToMerge * Signature: (J)I */ -jint Java_org_rocksdb_Options_minWriteBufferNumberToMerge( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_minWriteBufferNumberToMerge(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->min_write_buffer_number_to_merge; } @@ -2473,8 +2470,8 @@ void Java_org_rocksdb_Options_setMinWriteBufferNumberToMerge( * Method: maxWriteBufferNumberToMaintain * Signature: (J)I */ -jint Java_org_rocksdb_Options_maxWriteBufferNumberToMaintain( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_maxWriteBufferNumberToMaintain(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_write_buffer_number_to_maintain; } @@ -2510,8 +2507,8 @@ void Java_org_rocksdb_Options_setCompressionType( * Method: compressionType * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_compressionType( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_compressionType(JNIEnv*, jobject, + jlong jhandle) { auto* opts = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( opts->compression); @@ -2618,8 +2615,8 @@ void Java_org_rocksdb_Options_setCompressionPerLevel( * Method: compressionPerLevel * Signature: (J)[B */ -jbyteArray Java_org_rocksdb_Options_compressionPerLevel( - JNIEnv* env, jobject, jlong jhandle) { +jbyteArray Java_org_rocksdb_Options_compressionPerLevel(JNIEnv* env, jobject, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return rocksdb_compression_list_helper(env, options->compression_per_level); } @@ -2642,8 +2639,8 @@ void Java_org_rocksdb_Options_setBottommostCompressionType( * Method: bottommostCompressionType * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_bottommostCompressionType( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_bottommostCompressionType(JNIEnv*, jobject, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( options->bottommost_compression); @@ -2683,8 +2680,9 @@ void Java_org_rocksdb_Options_setCompressionOptions( * Method: setCompactionStyle * Signature: (JB)V */ -void Java_org_rocksdb_Options_setCompactionStyle( - JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_style) { +void Java_org_rocksdb_Options_setCompactionStyle(JNIEnv*, jobject, + jlong jhandle, + jbyte jcompaction_style) { auto* options = reinterpret_cast(jhandle); options->compaction_style = ROCKSDB_NAMESPACE::CompactionStyleJni::toCppCompactionStyle( @@ -2696,8 +2694,8 @@ void Java_org_rocksdb_Options_setCompactionStyle( * Method: compactionStyle * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_compactionStyle( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_compactionStyle(JNIEnv*, jobject, + jlong jhandle) { auto* options = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompactionStyleJni::toJavaCompactionStyle( options->compaction_style); @@ -2720,8 +2718,8 @@ void Java_org_rocksdb_Options_setMaxTableFilesSizeFIFO( * Method: maxTableFilesSizeFIFO * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->compaction_options_fifo.max_table_files_size; } @@ -2731,8 +2729,7 @@ jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO( * Method: numLevels * Signature: (J)I */ -jint Java_org_rocksdb_Options_numLevels( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_numLevels(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->num_levels; } @@ -2741,8 +2738,8 @@ jint Java_org_rocksdb_Options_numLevels( * Method: setNumLevels * Signature: (JI)V */ -void Java_org_rocksdb_Options_setNumLevels( - JNIEnv*, jobject, jlong jhandle, jint jnum_levels) { +void Java_org_rocksdb_Options_setNumLevels(JNIEnv*, jobject, jlong jhandle, + jint jnum_levels) { reinterpret_cast(jhandle)->num_levels = static_cast(jnum_levels); } @@ -2752,8 +2749,9 @@ void Java_org_rocksdb_Options_setNumLevels( * Method: levelZeroFileNumCompactionTrigger * Signature: (J)I */ -jint Java_org_rocksdb_Options_levelZeroFileNumCompactionTrigger( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_levelZeroFileNumCompactionTrigger(JNIEnv*, + jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger; } @@ -2764,8 +2762,7 @@ jint Java_org_rocksdb_Options_levelZeroFileNumCompactionTrigger( * Signature: (JI)V */ void Java_org_rocksdb_Options_setLevelZeroFileNumCompactionTrigger( - JNIEnv*, jobject, jlong jhandle, - jint jlevel0_file_num_compaction_trigger) { + JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); @@ -2776,8 +2773,8 @@ void Java_org_rocksdb_Options_setLevelZeroFileNumCompactionTrigger( * Method: levelZeroSlowdownWritesTrigger * Signature: (J)I */ -jint Java_org_rocksdb_Options_levelZeroSlowdownWritesTrigger( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_levelZeroSlowdownWritesTrigger(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger; } @@ -2799,8 +2796,8 @@ void Java_org_rocksdb_Options_setLevelZeroSlowdownWritesTrigger( * Method: levelZeroStopWritesTrigger * Signature: (J)I */ -jint Java_org_rocksdb_Options_levelZeroStopWritesTrigger( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_levelZeroStopWritesTrigger(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->level0_stop_writes_trigger; } @@ -2822,8 +2819,8 @@ void Java_org_rocksdb_Options_setLevelZeroStopWritesTrigger( * Method: targetFileSizeBase * Signature: (J)J */ -jlong Java_org_rocksdb_Options_targetFileSizeBase( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_targetFileSizeBase(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->target_file_size_base; } @@ -2844,8 +2841,8 @@ void Java_org_rocksdb_Options_setTargetFileSizeBase( * Method: targetFileSizeMultiplier * Signature: (J)I */ -jint Java_org_rocksdb_Options_targetFileSizeMultiplier( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_targetFileSizeMultiplier(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->target_file_size_multiplier; } @@ -2867,8 +2864,8 @@ void Java_org_rocksdb_Options_setTargetFileSizeMultiplier( * Method: maxBytesForLevelBase * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxBytesForLevelBase( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxBytesForLevelBase(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_bytes_for_level_base; } @@ -2912,8 +2909,8 @@ void Java_org_rocksdb_Options_setLevelCompactionDynamicLevelBytes( * Method: maxBytesForLevelMultiplier * Signature: (J)D */ -jdouble Java_org_rocksdb_Options_maxBytesForLevelMultiplier( - JNIEnv*, jobject, jlong jhandle) { +jdouble Java_org_rocksdb_Options_maxBytesForLevelMultiplier(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_bytes_for_level_multiplier; } @@ -2935,8 +2932,8 @@ void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplier( * Method: maxCompactionBytes * Signature: (J)I */ -jlong Java_org_rocksdb_Options_maxCompactionBytes( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxCompactionBytes(JNIEnv*, jobject, + jlong jhandle) { return static_cast( reinterpret_cast(jhandle) ->max_compaction_bytes); @@ -2958,8 +2955,7 @@ void Java_org_rocksdb_Options_setMaxCompactionBytes( * Method: arenaBlockSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_arenaBlockSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_arenaBlockSize(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->arena_block_size; } @@ -2969,8 +2965,9 @@ jlong Java_org_rocksdb_Options_arenaBlockSize( * Method: setArenaBlockSize * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setArenaBlockSize( - JNIEnv* env, jobject, jlong jhandle, jlong jarena_block_size) { +void Java_org_rocksdb_Options_setArenaBlockSize(JNIEnv* env, jobject, + jlong jhandle, + jlong jarena_block_size) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(jarena_block_size); if (s.ok()) { @@ -2986,8 +2983,8 @@ void Java_org_rocksdb_Options_setArenaBlockSize( * Method: disableAutoCompactions * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_disableAutoCompactions( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_disableAutoCompactions(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->disable_auto_compactions; } @@ -3008,8 +3005,8 @@ void Java_org_rocksdb_Options_setDisableAutoCompactions( * Method: maxSequentialSkipInIterations * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxSequentialSkipInIterations( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxSequentialSkipInIterations(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations; } @@ -3020,8 +3017,7 @@ jlong Java_org_rocksdb_Options_maxSequentialSkipInIterations( * Signature: (JJ)V */ void Java_org_rocksdb_Options_setMaxSequentialSkipInIterations( - JNIEnv*, jobject, jlong jhandle, - jlong jmax_sequential_skip_in_iterations) { + JNIEnv*, jobject, jlong jhandle, jlong jmax_sequential_skip_in_iterations) { reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations = static_cast(jmax_sequential_skip_in_iterations); @@ -3032,8 +3028,8 @@ void Java_org_rocksdb_Options_setMaxSequentialSkipInIterations( * Method: inplaceUpdateSupport * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_inplaceUpdateSupport( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_inplaceUpdateSupport(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->inplace_update_support; } @@ -3054,8 +3050,8 @@ void Java_org_rocksdb_Options_setInplaceUpdateSupport( * Method: inplaceUpdateNumLocks * Signature: (J)J */ -jlong Java_org_rocksdb_Options_inplaceUpdateNumLocks( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_inplaceUpdateNumLocks(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->inplace_update_num_locks; } @@ -3082,8 +3078,8 @@ void Java_org_rocksdb_Options_setInplaceUpdateNumLocks( * Method: memtablePrefixBloomSizeRatio * Signature: (J)I */ -jdouble Java_org_rocksdb_Options_memtablePrefixBloomSizeRatio( - JNIEnv*, jobject, jlong jhandle) { +jdouble Java_org_rocksdb_Options_memtablePrefixBloomSizeRatio(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->memtable_prefix_bloom_size_ratio; } @@ -3152,8 +3148,7 @@ void Java_org_rocksdb_Options_setMemtableWholeKeyFiltering( * Method: bloomLocality * Signature: (J)I */ -jint Java_org_rocksdb_Options_bloomLocality( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_bloomLocality(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->bloom_locality; } @@ -3162,8 +3157,8 @@ jint Java_org_rocksdb_Options_bloomLocality( * Method: setBloomLocality * Signature: (JI)V */ -void Java_org_rocksdb_Options_setBloomLocality( - JNIEnv*, jobject, jlong jhandle, jint jbloom_locality) { +void Java_org_rocksdb_Options_setBloomLocality(JNIEnv*, jobject, jlong jhandle, + jint jbloom_locality) { reinterpret_cast(jhandle)->bloom_locality = static_cast(jbloom_locality); } @@ -3173,8 +3168,8 @@ void Java_org_rocksdb_Options_setBloomLocality( * Method: maxSuccessiveMerges * Signature: (J)J */ -jlong Java_org_rocksdb_Options_maxSuccessiveMerges( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_maxSuccessiveMerges(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_successive_merges; } @@ -3201,8 +3196,8 @@ void Java_org_rocksdb_Options_setMaxSuccessiveMerges( * Method: optimizeFiltersForHits * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_optimizeFiltersForHits( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_optimizeFiltersForHits(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->optimize_filters_for_hits; } @@ -3296,8 +3291,8 @@ void Java_org_rocksdb_Options_optimizeUniversalStyleCompaction( * Method: prepareForBulkLoad * Signature: (J)V */ -void Java_org_rocksdb_Options_prepareForBulkLoad( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_Options_prepareForBulkLoad(JNIEnv*, jobject, + jlong jhandle) { reinterpret_cast(jhandle)->PrepareForBulkLoad(); } @@ -3306,8 +3301,8 @@ void Java_org_rocksdb_Options_prepareForBulkLoad( * Method: memtableHugePageSize * Signature: (J)J */ -jlong Java_org_rocksdb_Options_memtableHugePageSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_memtableHugePageSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->memtable_huge_page_size; } @@ -3334,8 +3329,8 @@ void Java_org_rocksdb_Options_setMemtableHugePageSize( * Method: softPendingCompactionBytesLimit * Signature: (J)J */ -jlong Java_org_rocksdb_Options_softPendingCompactionBytesLimit( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_softPendingCompactionBytesLimit(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->soft_pending_compaction_bytes_limit; } @@ -3358,8 +3353,8 @@ void Java_org_rocksdb_Options_setSoftPendingCompactionBytesLimit( * Method: softHardCompactionBytesLimit * Signature: (J)J */ -jlong Java_org_rocksdb_Options_hardPendingCompactionBytesLimit( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_hardPendingCompactionBytesLimit(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->hard_pending_compaction_bytes_limit; } @@ -3382,8 +3377,8 @@ void Java_org_rocksdb_Options_setHardPendingCompactionBytesLimit( * Method: level0FileNumCompactionTrigger * Signature: (J)I */ -jint Java_org_rocksdb_Options_level0FileNumCompactionTrigger( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_level0FileNumCompactionTrigger(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger; } @@ -3394,8 +3389,7 @@ jint Java_org_rocksdb_Options_level0FileNumCompactionTrigger( * Signature: (JI)V */ void Java_org_rocksdb_Options_setLevel0FileNumCompactionTrigger( - JNIEnv*, jobject, jlong jhandle, - jint jlevel0_file_num_compaction_trigger) { + JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); @@ -3406,8 +3400,8 @@ void Java_org_rocksdb_Options_setLevel0FileNumCompactionTrigger( * Method: level0SlowdownWritesTrigger * Signature: (J)I */ -jint Java_org_rocksdb_Options_level0SlowdownWritesTrigger( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_level0SlowdownWritesTrigger(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->level0_slowdown_writes_trigger; } @@ -3429,8 +3423,8 @@ void Java_org_rocksdb_Options_setLevel0SlowdownWritesTrigger( * Method: level0StopWritesTrigger * Signature: (J)I */ -jint Java_org_rocksdb_Options_level0StopWritesTrigger( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_Options_level0StopWritesTrigger(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->level0_stop_writes_trigger; } @@ -3517,8 +3511,8 @@ void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplierAdditional( * Method: paranoidFileChecks * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_paranoidFileChecks( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_paranoidFileChecks(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->paranoid_file_checks; } @@ -3552,8 +3546,8 @@ void Java_org_rocksdb_Options_setCompactionPriority( * Method: compactionPriority * Signature: (J)B */ -jbyte Java_org_rocksdb_Options_compactionPriority( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Options_compactionPriority(JNIEnv*, jobject, + jlong jhandle) { auto* opts = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompactionPriorityJni::toJavaCompactionPriority( opts->compaction_pri); @@ -3564,8 +3558,9 @@ jbyte Java_org_rocksdb_Options_compactionPriority( * Method: setReportBgIoStats * Signature: (JZ)V */ -void Java_org_rocksdb_Options_setReportBgIoStats( - JNIEnv*, jobject, jlong jhandle, jboolean jreport_bg_io_stats) { +void Java_org_rocksdb_Options_setReportBgIoStats(JNIEnv*, jobject, + jlong jhandle, + jboolean jreport_bg_io_stats) { auto* opts = reinterpret_cast(jhandle); opts->report_bg_io_stats = static_cast(jreport_bg_io_stats); } @@ -3575,8 +3570,8 @@ void Java_org_rocksdb_Options_setReportBgIoStats( * Method: reportBgIoStats * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_reportBgIoStats( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_reportBgIoStats(JNIEnv*, jobject, + jlong jhandle) { auto* opts = reinterpret_cast(jhandle); return static_cast(opts->report_bg_io_stats); } @@ -3586,8 +3581,8 @@ jboolean Java_org_rocksdb_Options_reportBgIoStats( * Method: setTtl * Signature: (JJ)V */ -void Java_org_rocksdb_Options_setTtl( - JNIEnv*, jobject, jlong jhandle, jlong jttl) { +void Java_org_rocksdb_Options_setTtl(JNIEnv*, jobject, jlong jhandle, + jlong jttl) { auto* opts = reinterpret_cast(jhandle); opts->ttl = static_cast(jttl); } @@ -3597,8 +3592,7 @@ void Java_org_rocksdb_Options_setTtl( * Method: ttl * Signature: (J)J */ -jlong Java_org_rocksdb_Options_ttl( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_Options_ttl(JNIEnv*, jobject, jlong jhandle) { auto* opts = reinterpret_cast(jhandle); return static_cast(opts->ttl); } @@ -3670,8 +3664,8 @@ void Java_org_rocksdb_Options_setForceConsistencyChecks( * Method: forceConsistencyChecks * Signature: (J)Z */ -jboolean Java_org_rocksdb_Options_forceConsistencyChecks( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_Options_forceConsistencyChecks(JNIEnv*, jobject, + jlong jhandle) { auto* opts = reinterpret_cast(jhandle); return static_cast(opts->force_consistency_checks); } @@ -3918,8 +3912,8 @@ jbyte Java_org_rocksdb_Options_prepopulateBlobCache(JNIEnv*, jobject, * Method: newColumnFamilyOptions * Signature: ()J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptions(JNIEnv*, + jclass) { auto* op = new ROCKSDB_NAMESPACE::ColumnFamilyOptions(); return GET_CPLUSPLUS_POINTER(op); } @@ -4019,8 +4013,8 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_getColumnFamilyOptionsFromProps__Ljav * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_ColumnFamilyOptions_disposeInternal( - JNIEnv*, jobject, jlong handle) { +void Java_org_rocksdb_ColumnFamilyOptions_disposeInternal(JNIEnv*, jobject, + jlong handle) { auto* cfo = reinterpret_cast(handle); assert(cfo != nullptr); delete cfo; @@ -4227,8 +4221,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setWriteBufferSize( * Method: writeBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_writeBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_writeBufferSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->write_buffer_size; } @@ -4249,8 +4243,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumber( * Method: maxWriteBufferNumber * Signature: (J)I */ -jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumber( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumber(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_write_buffer_number; } @@ -4356,8 +4350,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionThreadLimiter( * Method: tableFactoryName * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_ColumnFamilyOptions_tableFactoryName( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_ColumnFamilyOptions_tableFactoryName(JNIEnv* env, + jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); ROCKSDB_NAMESPACE::TableFactory* tf = opt->table_factory.get(); @@ -4481,8 +4476,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompressionType( * Method: compressionType * Signature: (J)B */ -jbyte Java_org_rocksdb_ColumnFamilyOptions_compressionType( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_ColumnFamilyOptions_compressionType(JNIEnv*, jobject, + jlong jhandle) { auto* cf_opts = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompressionTypeJni::toJavaCompressionType( @@ -4596,8 +4591,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionStyle( * Method: compactionStyle * Signature: (J)B */ -jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionStyle( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionStyle(JNIEnv*, jobject, + jlong jhandle) { auto* cf_options = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompactionStyleJni::toJavaCompactionStyle( @@ -4632,8 +4627,8 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxTableFilesSizeFIFO( * Method: numLevels * Signature: (J)I */ -jint Java_org_rocksdb_ColumnFamilyOptions_numLevels( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_ColumnFamilyOptions_numLevels(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->num_levels; } @@ -4643,8 +4638,9 @@ jint Java_org_rocksdb_ColumnFamilyOptions_numLevels( * Method: setNumLevels * Signature: (JI)V */ -void Java_org_rocksdb_ColumnFamilyOptions_setNumLevels( - JNIEnv*, jobject, jlong jhandle, jint jnum_levels) { +void Java_org_rocksdb_ColumnFamilyOptions_setNumLevels(JNIEnv*, jobject, + jlong jhandle, + jint jnum_levels) { reinterpret_cast(jhandle) ->num_levels = static_cast(jnum_levels); } @@ -4666,8 +4662,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroFileNumCompactionTrigger( * Signature: (JI)V */ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroFileNumCompactionTrigger( - JNIEnv*, jobject, jlong jhandle, - jint jlevel0_file_num_compaction_trigger) { + JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); @@ -4724,8 +4719,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroStopWritesTrigger( * Method: targetFileSizeBase * Signature: (J)J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeBase( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeBase(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->target_file_size_base; } @@ -4769,8 +4764,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeMultiplier( * Method: maxBytesForLevelBase * Signature: (J)J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelBase( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelBase(JNIEnv*, + jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_bytes_for_level_base; } @@ -4837,8 +4833,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplier( * Method: maxCompactionBytes * Signature: (J)I */ -jlong Java_org_rocksdb_ColumnFamilyOptions_maxCompactionBytes( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_maxCompactionBytes(JNIEnv*, jobject, + jlong jhandle) { return static_cast( reinterpret_cast(jhandle) ->max_compaction_bytes); @@ -4860,8 +4856,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxCompactionBytes( * Method: arenaBlockSize * Signature: (J)J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_arenaBlockSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_arenaBlockSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->arena_block_size; } @@ -4922,8 +4918,7 @@ jlong Java_org_rocksdb_ColumnFamilyOptions_maxSequentialSkipInIterations( * Signature: (JJ)V */ void Java_org_rocksdb_ColumnFamilyOptions_setMaxSequentialSkipInIterations( - JNIEnv*, jobject, jlong jhandle, - jlong jmax_sequential_skip_in_iterations) { + JNIEnv*, jobject, jlong jhandle, jlong jmax_sequential_skip_in_iterations) { reinterpret_cast(jhandle) ->max_sequential_skip_in_iterations = static_cast(jmax_sequential_skip_in_iterations); @@ -5054,8 +5049,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMemtableWholeKeyFiltering( * Method: bloomLocality * Signature: (J)I */ -jint Java_org_rocksdb_ColumnFamilyOptions_bloomLocality( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_ColumnFamilyOptions_bloomLocality(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->bloom_locality; } @@ -5076,8 +5071,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setBloomLocality( * Method: maxSuccessiveMerges * Signature: (J)J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_maxSuccessiveMerges( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_maxSuccessiveMerges(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_successive_merges; } @@ -5127,8 +5122,9 @@ void Java_org_rocksdb_ColumnFamilyOptions_setOptimizeFiltersForHits( * Method: memtableHugePageSize * Signature: (J)J */ -jlong Java_org_rocksdb_ColumnFamilyOptions_memtableHugePageSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ColumnFamilyOptions_memtableHugePageSize(JNIEnv*, + jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->memtable_huge_page_size; } @@ -5215,8 +5211,7 @@ jint Java_org_rocksdb_ColumnFamilyOptions_level0FileNumCompactionTrigger( * Signature: (JI)V */ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0FileNumCompactionTrigger( - JNIEnv*, jobject, jlong jhandle, - jint jlevel0_file_num_compaction_trigger) { + JNIEnv*, jobject, jlong jhandle, jint jlevel0_file_num_compaction_trigger) { reinterpret_cast(jhandle) ->level0_file_num_compaction_trigger = static_cast(jlevel0_file_num_compaction_trigger); @@ -5273,7 +5268,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setLevel0StopWritesTrigger( * Method: maxBytesForLevelMultiplierAdditional * Signature: (J)[I */ -jintArray Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplierAdditional( +jintArray +Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplierAdditional( JNIEnv* env, jobject, jlong jhandle) { auto mbflma = reinterpret_cast(jhandle) @@ -5375,8 +5371,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setCompactionPriority( * Method: compactionPriority * Signature: (J)B */ -jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionPriority( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionPriority(JNIEnv*, jobject, + jlong jhandle) { auto* cf_opts = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::CompactionPriorityJni::toJavaCompactionPriority( @@ -5400,8 +5396,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setReportBgIoStats( * Method: reportBgIoStats * Signature: (J)Z */ -jboolean Java_org_rocksdb_ColumnFamilyOptions_reportBgIoStats( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ColumnFamilyOptions_reportBgIoStats(JNIEnv*, jobject, + jlong jhandle) { auto* cf_opts = reinterpret_cast(jhandle); return static_cast(cf_opts->report_bg_io_stats); @@ -5412,8 +5408,8 @@ jboolean Java_org_rocksdb_ColumnFamilyOptions_reportBgIoStats( * Method: setTtl * Signature: (JJ)V */ -void Java_org_rocksdb_ColumnFamilyOptions_setTtl( - JNIEnv*, jobject, jlong jhandle, jlong jttl) { +void Java_org_rocksdb_ColumnFamilyOptions_setTtl(JNIEnv*, jobject, + jlong jhandle, jlong jttl) { auto* cf_opts = reinterpret_cast(jhandle); cf_opts->ttl = static_cast(jttl); @@ -5424,8 +5420,8 @@ void Java_org_rocksdb_ColumnFamilyOptions_setTtl( * Method: ttl * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_rocksdb_ColumnFamilyOptions_ttl( - JNIEnv*, jobject, jlong jhandle) { +JNIEXPORT jlong JNICALL +Java_org_rocksdb_ColumnFamilyOptions_ttl(JNIEnv*, jobject, jlong jhandle) { auto* cf_opts = reinterpret_cast(jhandle); return static_cast(cf_opts->ttl); @@ -5778,8 +5774,7 @@ jbyte Java_org_rocksdb_ColumnFamilyOptions_prepopulateBlobCache(JNIEnv*, * Method: newDBOptions * Signature: ()J */ -jlong Java_org_rocksdb_DBOptions_newDBOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_DBOptions_newDBOptions(JNIEnv*, jclass) { auto* dbop = new ROCKSDB_NAMESPACE::DBOptions(); return GET_CPLUSPLUS_POINTER(dbop); } @@ -5789,8 +5784,7 @@ jlong Java_org_rocksdb_DBOptions_newDBOptions( * Method: copyDBOptions * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_copyDBOptions( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_copyDBOptions(JNIEnv*, jclass, jlong jhandle) { auto new_opt = new ROCKSDB_NAMESPACE::DBOptions( *(reinterpret_cast(jhandle))); return GET_CPLUSPLUS_POINTER(new_opt); @@ -5877,8 +5871,8 @@ jlong Java_org_rocksdb_DBOptions_getDBOptionsFromProps__Ljava_lang_String_2( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_DBOptions_disposeInternal( - JNIEnv*, jobject, jlong handle) { +void Java_org_rocksdb_DBOptions_disposeInternal(JNIEnv*, jobject, + jlong handle) { auto* dbo = reinterpret_cast(handle); assert(dbo != nullptr); delete dbo; @@ -5889,8 +5883,8 @@ void Java_org_rocksdb_DBOptions_disposeInternal( * Method: optimizeForSmallDb * Signature: (J)V */ -void Java_org_rocksdb_DBOptions_optimizeForSmallDb( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_DBOptions_optimizeForSmallDb(JNIEnv*, jobject, + jlong jhandle) { reinterpret_cast(jhandle) ->OptimizeForSmallDb(); } @@ -5900,8 +5894,8 @@ void Java_org_rocksdb_DBOptions_optimizeForSmallDb( * Method: setEnv * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setEnv( - JNIEnv*, jobject, jlong jhandle, jlong jenv_handle) { +void Java_org_rocksdb_DBOptions_setEnv(JNIEnv*, jobject, jlong jhandle, + jlong jenv_handle) { reinterpret_cast(jhandle)->env = reinterpret_cast(jenv_handle); } @@ -5911,8 +5905,9 @@ void Java_org_rocksdb_DBOptions_setEnv( * Method: setIncreaseParallelism * Signature: (JI)V */ -void Java_org_rocksdb_DBOptions_setIncreaseParallelism( - JNIEnv*, jobject, jlong jhandle, jint totalThreads) { +void Java_org_rocksdb_DBOptions_setIncreaseParallelism(JNIEnv*, jobject, + jlong jhandle, + jint totalThreads) { reinterpret_cast(jhandle)->IncreaseParallelism( static_cast(totalThreads)); } @@ -5922,8 +5917,9 @@ void Java_org_rocksdb_DBOptions_setIncreaseParallelism( * Method: setCreateIfMissing * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setCreateIfMissing( - JNIEnv*, jobject, jlong jhandle, jboolean flag) { +void Java_org_rocksdb_DBOptions_setCreateIfMissing(JNIEnv*, jobject, + jlong jhandle, + jboolean flag) { reinterpret_cast(jhandle)->create_if_missing = flag; } @@ -5933,8 +5929,8 @@ void Java_org_rocksdb_DBOptions_setCreateIfMissing( * Method: createIfMissing * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_createIfMissing( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_createIfMissing(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->create_if_missing; } @@ -5944,8 +5940,9 @@ jboolean Java_org_rocksdb_DBOptions_createIfMissing( * Method: setCreateMissingColumnFamilies * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setCreateMissingColumnFamilies( - JNIEnv*, jobject, jlong jhandle, jboolean flag) { +void Java_org_rocksdb_DBOptions_setCreateMissingColumnFamilies(JNIEnv*, jobject, + jlong jhandle, + jboolean flag) { reinterpret_cast(jhandle) ->create_missing_column_families = flag; } @@ -5955,8 +5952,9 @@ void Java_org_rocksdb_DBOptions_setCreateMissingColumnFamilies( * Method: createMissingColumnFamilies * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_createMissingColumnFamilies( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_createMissingColumnFamilies(JNIEnv*, + jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->create_missing_column_families; } @@ -5966,8 +5964,9 @@ jboolean Java_org_rocksdb_DBOptions_createMissingColumnFamilies( * Method: setErrorIfExists * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setErrorIfExists( - JNIEnv*, jobject, jlong jhandle, jboolean error_if_exists) { +void Java_org_rocksdb_DBOptions_setErrorIfExists(JNIEnv*, jobject, + jlong jhandle, + jboolean error_if_exists) { reinterpret_cast(jhandle)->error_if_exists = static_cast(error_if_exists); } @@ -5977,8 +5976,8 @@ void Java_org_rocksdb_DBOptions_setErrorIfExists( * Method: errorIfExists * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_errorIfExists( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_errorIfExists(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->error_if_exists; } @@ -5988,8 +5987,9 @@ jboolean Java_org_rocksdb_DBOptions_errorIfExists( * Method: setParanoidChecks * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setParanoidChecks( - JNIEnv*, jobject, jlong jhandle, jboolean paranoid_checks) { +void Java_org_rocksdb_DBOptions_setParanoidChecks(JNIEnv*, jobject, + jlong jhandle, + jboolean paranoid_checks) { reinterpret_cast(jhandle)->paranoid_checks = static_cast(paranoid_checks); } @@ -5999,8 +5999,8 @@ void Java_org_rocksdb_DBOptions_setParanoidChecks( * Method: paranoidChecks * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_paranoidChecks( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_paranoidChecks(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->paranoid_checks; } @@ -6010,8 +6010,8 @@ jboolean Java_org_rocksdb_DBOptions_paranoidChecks( * Method: setRateLimiter * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setRateLimiter( - JNIEnv*, jobject, jlong jhandle, jlong jrate_limiter_handle) { +void Java_org_rocksdb_DBOptions_setRateLimiter(JNIEnv*, jobject, jlong jhandle, + jlong jrate_limiter_handle) { std::shared_ptr* pRateLimiter = reinterpret_cast*>( jrate_limiter_handle); @@ -6038,8 +6038,8 @@ void Java_org_rocksdb_DBOptions_setSstFileManager( * Method: setLogger * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setLogger( - JNIEnv*, jobject, jlong jhandle, jlong jlogger_handle) { +void Java_org_rocksdb_DBOptions_setLogger(JNIEnv*, jobject, jlong jhandle, + jlong jlogger_handle) { std::shared_ptr* pLogger = reinterpret_cast*>( jlogger_handle); @@ -6051,8 +6051,8 @@ void Java_org_rocksdb_DBOptions_setLogger( * Method: setInfoLogLevel * Signature: (JB)V */ -void Java_org_rocksdb_DBOptions_setInfoLogLevel( - JNIEnv*, jobject, jlong jhandle, jbyte jlog_level) { +void Java_org_rocksdb_DBOptions_setInfoLogLevel(JNIEnv*, jobject, jlong jhandle, + jbyte jlog_level) { reinterpret_cast(jhandle)->info_log_level = static_cast(jlog_level); } @@ -6062,8 +6062,7 @@ void Java_org_rocksdb_DBOptions_setInfoLogLevel( * Method: infoLogLevel * Signature: (J)B */ -jbyte Java_org_rocksdb_DBOptions_infoLogLevel( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_DBOptions_infoLogLevel(JNIEnv*, jobject, jlong jhandle) { return static_cast( reinterpret_cast(jhandle)->info_log_level); } @@ -6073,8 +6072,9 @@ jbyte Java_org_rocksdb_DBOptions_infoLogLevel( * Method: setMaxTotalWalSize * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setMaxTotalWalSize( - JNIEnv*, jobject, jlong jhandle, jlong jmax_total_wal_size) { +void Java_org_rocksdb_DBOptions_setMaxTotalWalSize(JNIEnv*, jobject, + jlong jhandle, + jlong jmax_total_wal_size) { reinterpret_cast(jhandle)->max_total_wal_size = static_cast(jmax_total_wal_size); } @@ -6084,8 +6084,8 @@ void Java_org_rocksdb_DBOptions_setMaxTotalWalSize( * Method: maxTotalWalSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_maxTotalWalSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_maxTotalWalSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_total_wal_size; } @@ -6095,8 +6095,8 @@ jlong Java_org_rocksdb_DBOptions_maxTotalWalSize( * Method: setMaxOpenFiles * Signature: (JI)V */ -void Java_org_rocksdb_DBOptions_setMaxOpenFiles( - JNIEnv*, jobject, jlong jhandle, jint max_open_files) { +void Java_org_rocksdb_DBOptions_setMaxOpenFiles(JNIEnv*, jobject, jlong jhandle, + jint max_open_files) { reinterpret_cast(jhandle)->max_open_files = static_cast(max_open_files); } @@ -6106,8 +6106,7 @@ void Java_org_rocksdb_DBOptions_setMaxOpenFiles( * Method: maxOpenFiles * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_maxOpenFiles( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_maxOpenFiles(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->max_open_files; } @@ -6128,8 +6127,8 @@ void Java_org_rocksdb_DBOptions_setMaxFileOpeningThreads( * Method: maxFileOpeningThreads * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_maxFileOpeningThreads( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_maxFileOpeningThreads(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_file_opening_threads); } @@ -6139,8 +6138,8 @@ jint Java_org_rocksdb_DBOptions_maxFileOpeningThreads( * Method: setStatistics * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setStatistics( - JNIEnv*, jobject, jlong jhandle, jlong jstatistics_handle) { +void Java_org_rocksdb_DBOptions_setStatistics(JNIEnv*, jobject, jlong jhandle, + jlong jstatistics_handle) { auto* opt = reinterpret_cast(jhandle); auto* pSptr = reinterpret_cast*>( @@ -6153,8 +6152,7 @@ void Java_org_rocksdb_DBOptions_setStatistics( * Method: statistics * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_statistics( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_statistics(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); std::shared_ptr sptr = opt->statistics; if (sptr == nullptr) { @@ -6171,8 +6169,8 @@ jlong Java_org_rocksdb_DBOptions_statistics( * Method: setUseFsync * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setUseFsync( - JNIEnv*, jobject, jlong jhandle, jboolean use_fsync) { +void Java_org_rocksdb_DBOptions_setUseFsync(JNIEnv*, jobject, jlong jhandle, + jboolean use_fsync) { reinterpret_cast(jhandle)->use_fsync = static_cast(use_fsync); } @@ -6182,8 +6180,7 @@ void Java_org_rocksdb_DBOptions_setUseFsync( * Method: useFsync * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_useFsync( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_useFsync(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->use_fsync; } @@ -6192,9 +6189,9 @@ jboolean Java_org_rocksdb_DBOptions_useFsync( * Method: setDbPaths * Signature: (J[Ljava/lang/String;[J)V */ -void Java_org_rocksdb_DBOptions_setDbPaths( - JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths, - jlongArray jtarget_sizes) { +void Java_org_rocksdb_DBOptions_setDbPaths(JNIEnv* env, jobject, jlong jhandle, + jobjectArray jpaths, + jlongArray jtarget_sizes) { std::vector db_paths; jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr); if (ptr_jtarget_size == nullptr) { @@ -6238,8 +6235,7 @@ void Java_org_rocksdb_DBOptions_setDbPaths( * Method: dbPathsLen * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_dbPathsLen( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_dbPathsLen(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_paths.size()); } @@ -6249,9 +6245,9 @@ jlong Java_org_rocksdb_DBOptions_dbPathsLen( * Method: dbPaths * Signature: (J[Ljava/lang/String;[J)V */ -void Java_org_rocksdb_DBOptions_dbPaths( - JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths, - jlongArray jtarget_sizes) { +void Java_org_rocksdb_DBOptions_dbPaths(JNIEnv* env, jobject, jlong jhandle, + jobjectArray jpaths, + jlongArray jtarget_sizes) { jboolean is_copy; jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, &is_copy); if (ptr_jtarget_size == nullptr) { @@ -6290,8 +6286,8 @@ void Java_org_rocksdb_DBOptions_dbPaths( * Method: setDbLogDir * Signature: (JLjava/lang/String)V */ -void Java_org_rocksdb_DBOptions_setDbLogDir( - JNIEnv* env, jobject, jlong jhandle, jstring jdb_log_dir) { +void Java_org_rocksdb_DBOptions_setDbLogDir(JNIEnv* env, jobject, jlong jhandle, + jstring jdb_log_dir) { const char* log_dir = env->GetStringUTFChars(jdb_log_dir, nullptr); if (log_dir == nullptr) { // exception thrown: OutOfMemoryError @@ -6308,8 +6304,8 @@ void Java_org_rocksdb_DBOptions_setDbLogDir( * Method: dbLogDir * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_DBOptions_dbLogDir( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_DBOptions_dbLogDir(JNIEnv* env, jobject, + jlong jhandle) { return env->NewStringUTF( reinterpret_cast(jhandle) ->db_log_dir.c_str()); @@ -6320,8 +6316,8 @@ jstring Java_org_rocksdb_DBOptions_dbLogDir( * Method: setWalDir * Signature: (JLjava/lang/String)V */ -void Java_org_rocksdb_DBOptions_setWalDir( - JNIEnv* env, jobject, jlong jhandle, jstring jwal_dir) { +void Java_org_rocksdb_DBOptions_setWalDir(JNIEnv* env, jobject, jlong jhandle, + jstring jwal_dir) { const char* wal_dir = env->GetStringUTFChars(jwal_dir, 0); reinterpret_cast(jhandle)->wal_dir.assign( wal_dir); @@ -6333,8 +6329,7 @@ void Java_org_rocksdb_DBOptions_setWalDir( * Method: walDir * Signature: (J)Ljava/lang/String */ -jstring Java_org_rocksdb_DBOptions_walDir( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_DBOptions_walDir(JNIEnv* env, jobject, jlong jhandle) { return env->NewStringUTF( reinterpret_cast(jhandle) ->wal_dir.c_str()); @@ -6367,8 +6362,9 @@ jlong Java_org_rocksdb_DBOptions_deleteObsoleteFilesPeriodMicros( * Method: setMaxBackgroundCompactions * Signature: (JI)V */ -void Java_org_rocksdb_DBOptions_setMaxBackgroundCompactions( - JNIEnv*, jobject, jlong jhandle, jint max) { +void Java_org_rocksdb_DBOptions_setMaxBackgroundCompactions(JNIEnv*, jobject, + jlong jhandle, + jint max) { reinterpret_cast(jhandle) ->max_background_compactions = static_cast(max); } @@ -6378,8 +6374,8 @@ void Java_org_rocksdb_DBOptions_setMaxBackgroundCompactions( * Method: maxBackgroundCompactions * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_maxBackgroundCompactions( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_maxBackgroundCompactions(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_background_compactions; } @@ -6389,8 +6385,8 @@ jint Java_org_rocksdb_DBOptions_maxBackgroundCompactions( * Method: setMaxSubcompactions * Signature: (JI)V */ -void Java_org_rocksdb_DBOptions_setMaxSubcompactions( - JNIEnv*, jobject, jlong jhandle, jint max) { +void Java_org_rocksdb_DBOptions_setMaxSubcompactions(JNIEnv*, jobject, + jlong jhandle, jint max) { reinterpret_cast(jhandle)->max_subcompactions = static_cast(max); } @@ -6400,8 +6396,8 @@ void Java_org_rocksdb_DBOptions_setMaxSubcompactions( * Method: maxSubcompactions * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_maxSubcompactions( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_maxSubcompactions(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_subcompactions; } @@ -6422,8 +6418,8 @@ void Java_org_rocksdb_DBOptions_setMaxBackgroundFlushes( * Method: maxBackgroundFlushes * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_maxBackgroundFlushes( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_maxBackgroundFlushes(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_background_flushes; } @@ -6433,8 +6429,9 @@ jint Java_org_rocksdb_DBOptions_maxBackgroundFlushes( * Method: setMaxBackgroundJobs * Signature: (JI)V */ -void Java_org_rocksdb_DBOptions_setMaxBackgroundJobs( - JNIEnv*, jobject, jlong jhandle, jint max_background_jobs) { +void Java_org_rocksdb_DBOptions_setMaxBackgroundJobs(JNIEnv*, jobject, + jlong jhandle, + jint max_background_jobs) { reinterpret_cast(jhandle) ->max_background_jobs = static_cast(max_background_jobs); } @@ -6444,8 +6441,8 @@ void Java_org_rocksdb_DBOptions_setMaxBackgroundJobs( * Method: maxBackgroundJobs * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_maxBackgroundJobs( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_maxBackgroundJobs(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_background_jobs; } @@ -6455,8 +6452,9 @@ jint Java_org_rocksdb_DBOptions_maxBackgroundJobs( * Method: setMaxLogFileSize * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setMaxLogFileSize( - JNIEnv* env, jobject, jlong jhandle, jlong max_log_file_size) { +void Java_org_rocksdb_DBOptions_setMaxLogFileSize(JNIEnv* env, jobject, + jlong jhandle, + jlong max_log_file_size) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(max_log_file_size); if (s.ok()) { @@ -6472,8 +6470,8 @@ void Java_org_rocksdb_DBOptions_setMaxLogFileSize( * Method: maxLogFileSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_maxLogFileSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_maxLogFileSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_log_file_size; } @@ -6500,8 +6498,8 @@ void Java_org_rocksdb_DBOptions_setLogFileTimeToRoll( * Method: logFileTimeToRoll * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_logFileTimeToRoll( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_logFileTimeToRoll(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->log_file_time_to_roll; } @@ -6511,8 +6509,9 @@ jlong Java_org_rocksdb_DBOptions_logFileTimeToRoll( * Method: setKeepLogFileNum * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setKeepLogFileNum( - JNIEnv* env, jobject, jlong jhandle, jlong keep_log_file_num) { +void Java_org_rocksdb_DBOptions_setKeepLogFileNum(JNIEnv* env, jobject, + jlong jhandle, + jlong keep_log_file_num) { auto s = ROCKSDB_NAMESPACE::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num); if (s.ok()) { @@ -6528,8 +6527,8 @@ void Java_org_rocksdb_DBOptions_setKeepLogFileNum( * Method: keepLogFileNum * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_keepLogFileNum( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_keepLogFileNum(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->keep_log_file_num; } @@ -6556,8 +6555,8 @@ void Java_org_rocksdb_DBOptions_setRecycleLogFileNum( * Method: recycleLogFileNum * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_recycleLogFileNum( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_recycleLogFileNum(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->recycle_log_file_num; } @@ -6578,8 +6577,8 @@ void Java_org_rocksdb_DBOptions_setMaxManifestFileSize( * Method: maxManifestFileSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_maxManifestFileSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_maxManifestFileSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->max_manifest_file_size; } @@ -6600,8 +6599,8 @@ void Java_org_rocksdb_DBOptions_setTableCacheNumshardbits( * Method: tableCacheNumshardbits * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_tableCacheNumshardbits( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_tableCacheNumshardbits(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->table_cache_numshardbits; } @@ -6611,8 +6610,9 @@ jint Java_org_rocksdb_DBOptions_tableCacheNumshardbits( * Method: setWalTtlSeconds * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setWalTtlSeconds( - JNIEnv*, jobject, jlong jhandle, jlong WAL_ttl_seconds) { +void Java_org_rocksdb_DBOptions_setWalTtlSeconds(JNIEnv*, jobject, + jlong jhandle, + jlong WAL_ttl_seconds) { reinterpret_cast(jhandle)->WAL_ttl_seconds = static_cast(WAL_ttl_seconds); } @@ -6622,8 +6622,8 @@ void Java_org_rocksdb_DBOptions_setWalTtlSeconds( * Method: walTtlSeconds * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_walTtlSeconds( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_walTtlSeconds(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->WAL_ttl_seconds; } @@ -6633,8 +6633,9 @@ jlong Java_org_rocksdb_DBOptions_walTtlSeconds( * Method: setWalSizeLimitMB * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setWalSizeLimitMB( - JNIEnv*, jobject, jlong jhandle, jlong WAL_size_limit_MB) { +void Java_org_rocksdb_DBOptions_setWalSizeLimitMB(JNIEnv*, jobject, + jlong jhandle, + jlong WAL_size_limit_MB) { reinterpret_cast(jhandle)->WAL_size_limit_MB = static_cast(WAL_size_limit_MB); } @@ -6644,8 +6645,8 @@ void Java_org_rocksdb_DBOptions_setWalSizeLimitMB( * Method: walTtlSeconds * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_walSizeLimitMB( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_walSizeLimitMB(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->WAL_size_limit_MB; } @@ -6695,8 +6696,8 @@ void Java_org_rocksdb_DBOptions_setManifestPreallocationSize( * Method: manifestPreallocationSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_manifestPreallocationSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_manifestPreallocationSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->manifest_preallocation_size; } @@ -6706,8 +6707,8 @@ jlong Java_org_rocksdb_DBOptions_manifestPreallocationSize( * Method: useDirectReads * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_useDirectReads( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_useDirectReads(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->use_direct_reads; } @@ -6717,8 +6718,9 @@ jboolean Java_org_rocksdb_DBOptions_useDirectReads( * Method: setUseDirectReads * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setUseDirectReads( - JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) { +void Java_org_rocksdb_DBOptions_setUseDirectReads(JNIEnv*, jobject, + jlong jhandle, + jboolean use_direct_reads) { reinterpret_cast(jhandle)->use_direct_reads = static_cast(use_direct_reads); } @@ -6752,8 +6754,9 @@ void Java_org_rocksdb_DBOptions_setUseDirectIoForFlushAndCompaction( * Method: setAllowFAllocate * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setAllowFAllocate( - JNIEnv*, jobject, jlong jhandle, jboolean jallow_fallocate) { +void Java_org_rocksdb_DBOptions_setAllowFAllocate(JNIEnv*, jobject, + jlong jhandle, + jboolean jallow_fallocate) { reinterpret_cast(jhandle)->allow_fallocate = static_cast(jallow_fallocate); } @@ -6763,8 +6766,8 @@ void Java_org_rocksdb_DBOptions_setAllowFAllocate( * Method: allowFAllocate * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_allowFAllocate( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_allowFAllocate(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_fallocate); } @@ -6774,8 +6777,9 @@ jboolean Java_org_rocksdb_DBOptions_allowFAllocate( * Method: setAllowMmapReads * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setAllowMmapReads( - JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_reads) { +void Java_org_rocksdb_DBOptions_setAllowMmapReads(JNIEnv*, jobject, + jlong jhandle, + jboolean allow_mmap_reads) { reinterpret_cast(jhandle)->allow_mmap_reads = static_cast(allow_mmap_reads); } @@ -6785,8 +6789,8 @@ void Java_org_rocksdb_DBOptions_setAllowMmapReads( * Method: allowMmapReads * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_allowMmapReads( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_allowMmapReads(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->allow_mmap_reads; } @@ -6796,8 +6800,9 @@ jboolean Java_org_rocksdb_DBOptions_allowMmapReads( * Method: setAllowMmapWrites * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setAllowMmapWrites( - JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_writes) { +void Java_org_rocksdb_DBOptions_setAllowMmapWrites(JNIEnv*, jobject, + jlong jhandle, + jboolean allow_mmap_writes) { reinterpret_cast(jhandle)->allow_mmap_writes = static_cast(allow_mmap_writes); } @@ -6807,8 +6812,8 @@ void Java_org_rocksdb_DBOptions_setAllowMmapWrites( * Method: allowMmapWrites * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_allowMmapWrites( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_allowMmapWrites(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->allow_mmap_writes; } @@ -6829,8 +6834,8 @@ void Java_org_rocksdb_DBOptions_setIsFdCloseOnExec( * Method: isFdCloseOnExec * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_isFdCloseOnExec( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_isFdCloseOnExec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->is_fd_close_on_exec; } @@ -6852,8 +6857,8 @@ void Java_org_rocksdb_DBOptions_setStatsDumpPeriodSec( * Method: statsDumpPeriodSec * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_statsDumpPeriodSec( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_statsDumpPeriodSec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->stats_dump_period_sec; } @@ -6875,8 +6880,8 @@ void Java_org_rocksdb_DBOptions_setStatsPersistPeriodSec( * Method: statsPersistPeriodSec * Signature: (J)I */ -jint Java_org_rocksdb_DBOptions_statsPersistPeriodSec( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_DBOptions_statsPersistPeriodSec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->stats_persist_period_sec; } @@ -6898,8 +6903,8 @@ void Java_org_rocksdb_DBOptions_setStatsHistoryBufferSize( * Method: statsHistoryBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_statsHistoryBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_statsHistoryBufferSize(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->stats_history_buffer_size; } @@ -6920,8 +6925,8 @@ void Java_org_rocksdb_DBOptions_setAdviseRandomOnOpen( * Method: adviseRandomOnOpen * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_adviseRandomOnOpen( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_adviseRandomOnOpen(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->advise_random_on_open; } @@ -6957,8 +6962,8 @@ void Java_org_rocksdb_DBOptions_setWriteBufferManager( * Method: dbWriteBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_dbWriteBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_dbWriteBufferSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->db_write_buffer_size); } @@ -6980,8 +6985,8 @@ void Java_org_rocksdb_DBOptions_setAccessHintOnCompactionStart( * Method: accessHintOnCompactionStart * Signature: (J)B */ -jbyte Java_org_rocksdb_DBOptions_accessHintOnCompactionStart( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_DBOptions_accessHintOnCompactionStart(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::AccessHintJni::toJavaAccessHint( opt->access_hint_on_compaction_start); @@ -7004,8 +7009,8 @@ void Java_org_rocksdb_DBOptions_setCompactionReadaheadSize( * Method: compactionReadaheadSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_compactionReadaheadSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_compactionReadaheadSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->compaction_readahead_size); } @@ -7027,8 +7032,8 @@ void Java_org_rocksdb_DBOptions_setRandomAccessMaxBufferSize( * Method: randomAccessMaxBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_randomAccessMaxBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_randomAccessMaxBufferSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->random_access_max_buffer_size); } @@ -7050,8 +7055,8 @@ void Java_org_rocksdb_DBOptions_setWritableFileMaxBufferSize( * Method: writableFileMaxBufferSize * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_writableFileMaxBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_writableFileMaxBufferSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->writable_file_max_buffer_size); } @@ -7072,8 +7077,8 @@ void Java_org_rocksdb_DBOptions_setUseAdaptiveMutex( * Method: useAdaptiveMutex * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_useAdaptiveMutex( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_useAdaptiveMutex(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->use_adaptive_mutex; } @@ -7083,8 +7088,8 @@ jboolean Java_org_rocksdb_DBOptions_useAdaptiveMutex( * Method: setBytesPerSync * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setBytesPerSync( - JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) { +void Java_org_rocksdb_DBOptions_setBytesPerSync(JNIEnv*, jobject, jlong jhandle, + jlong bytes_per_sync) { reinterpret_cast(jhandle)->bytes_per_sync = static_cast(bytes_per_sync); } @@ -7094,8 +7099,7 @@ void Java_org_rocksdb_DBOptions_setBytesPerSync( * Method: bytesPerSync * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_bytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_bytesPerSync(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle) ->bytes_per_sync; } @@ -7105,8 +7109,9 @@ jlong Java_org_rocksdb_DBOptions_bytesPerSync( * Method: setWalBytesPerSync * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setWalBytesPerSync( - JNIEnv*, jobject, jlong jhandle, jlong jwal_bytes_per_sync) { +void Java_org_rocksdb_DBOptions_setWalBytesPerSync(JNIEnv*, jobject, + jlong jhandle, + jlong jwal_bytes_per_sync) { reinterpret_cast(jhandle)->wal_bytes_per_sync = static_cast(jwal_bytes_per_sync); } @@ -7116,8 +7121,8 @@ void Java_org_rocksdb_DBOptions_setWalBytesPerSync( * Method: walBytesPerSync * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_walBytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_walBytesPerSync(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->wal_bytes_per_sync); } @@ -7138,8 +7143,8 @@ void Java_org_rocksdb_DBOptions_setStrictBytesPerSync( * Method: strictBytesPerSync * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_strictBytesPerSync( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_strictBytesPerSync(JNIEnv*, jobject, + jlong jhandle) { return static_cast( reinterpret_cast(jhandle) ->strict_bytes_per_sync); @@ -7173,8 +7178,9 @@ jobjectArray Java_org_rocksdb_DBOptions_eventListeners(JNIEnv* env, jclass, * Method: setDelayedWriteRate * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setDelayedWriteRate( - JNIEnv*, jobject, jlong jhandle, jlong jdelayed_write_rate) { +void Java_org_rocksdb_DBOptions_setDelayedWriteRate(JNIEnv*, jobject, + jlong jhandle, + jlong jdelayed_write_rate) { auto* opt = reinterpret_cast(jhandle); opt->delayed_write_rate = static_cast(jdelayed_write_rate); } @@ -7184,8 +7190,8 @@ void Java_org_rocksdb_DBOptions_setDelayedWriteRate( * Method: delayedWriteRate * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_delayedWriteRate( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_delayedWriteRate(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->delayed_write_rate); } @@ -7206,8 +7212,8 @@ void Java_org_rocksdb_DBOptions_setEnablePipelinedWrite( * Method: enablePipelinedWrite * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_enablePipelinedWrite( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_enablePipelinedWrite(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_pipelined_write); } @@ -7217,8 +7223,9 @@ jboolean Java_org_rocksdb_DBOptions_enablePipelinedWrite( * Method: setUnorderedWrite * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setUnorderedWrite( - JNIEnv*, jobject, jlong jhandle, jboolean junordered_write) { +void Java_org_rocksdb_DBOptions_setUnorderedWrite(JNIEnv*, jobject, + jlong jhandle, + jboolean junordered_write) { auto* opt = reinterpret_cast(jhandle); opt->unordered_write = junordered_write == JNI_TRUE; } @@ -7228,13 +7235,12 @@ void Java_org_rocksdb_DBOptions_setUnorderedWrite( * Method: unorderedWrite * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_unorderedWrite( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_unorderedWrite(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->unordered_write); } - /* * Class: org_rocksdb_DBOptions * Method: setEnableThreadTracking @@ -7251,8 +7257,8 @@ void Java_org_rocksdb_DBOptions_setEnableThreadTracking( * Method: enableThreadTracking * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_enableThreadTracking( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_enableThreadTracking(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->enable_thread_tracking); } @@ -7306,8 +7312,9 @@ jboolean Java_org_rocksdb_DBOptions_enableWriteThreadAdaptiveYield( * Method: setWriteThreadMaxYieldUsec * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setWriteThreadMaxYieldUsec( - JNIEnv*, jobject, jlong jhandle, jlong max) { +void Java_org_rocksdb_DBOptions_setWriteThreadMaxYieldUsec(JNIEnv*, jobject, + jlong jhandle, + jlong max) { reinterpret_cast(jhandle) ->write_thread_max_yield_usec = static_cast(max); } @@ -7317,8 +7324,8 @@ void Java_org_rocksdb_DBOptions_setWriteThreadMaxYieldUsec( * Method: writeThreadMaxYieldUsec * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_writeThreadMaxYieldUsec( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_writeThreadMaxYieldUsec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->write_thread_max_yield_usec; } @@ -7328,8 +7335,9 @@ jlong Java_org_rocksdb_DBOptions_writeThreadMaxYieldUsec( * Method: setWriteThreadSlowYieldUsec * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setWriteThreadSlowYieldUsec( - JNIEnv*, jobject, jlong jhandle, jlong slow) { +void Java_org_rocksdb_DBOptions_setWriteThreadSlowYieldUsec(JNIEnv*, jobject, + jlong jhandle, + jlong slow) { reinterpret_cast(jhandle) ->write_thread_slow_yield_usec = static_cast(slow); } @@ -7339,8 +7347,8 @@ void Java_org_rocksdb_DBOptions_setWriteThreadSlowYieldUsec( * Method: writeThreadSlowYieldUsec * Signature: (J)J */ -jlong Java_org_rocksdb_DBOptions_writeThreadSlowYieldUsec( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_DBOptions_writeThreadSlowYieldUsec(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->write_thread_slow_yield_usec; } @@ -7362,8 +7370,8 @@ void Java_org_rocksdb_DBOptions_setSkipStatsUpdateOnDbOpen( * Method: skipStatsUpdateOnDbOpen * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_skipStatsUpdateOnDbOpen( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_skipStatsUpdateOnDbOpen(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->skip_stats_update_on_db_open); } @@ -7410,8 +7418,8 @@ void Java_org_rocksdb_DBOptions_setWalRecoveryMode( * Method: walRecoveryMode * Signature: (J)B */ -jbyte Java_org_rocksdb_DBOptions_walRecoveryMode( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_DBOptions_walRecoveryMode(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return ROCKSDB_NAMESPACE::WALRecoveryModeJni::toJavaWALRecoveryMode( opt->wal_recovery_mode); @@ -7422,8 +7430,8 @@ jbyte Java_org_rocksdb_DBOptions_walRecoveryMode( * Method: setAllow2pc * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setAllow2pc( - JNIEnv*, jobject, jlong jhandle, jboolean jallow_2pc) { +void Java_org_rocksdb_DBOptions_setAllow2pc(JNIEnv*, jobject, jlong jhandle, + jboolean jallow_2pc) { auto* opt = reinterpret_cast(jhandle); opt->allow_2pc = static_cast(jallow_2pc); } @@ -7433,8 +7441,7 @@ void Java_org_rocksdb_DBOptions_setAllow2pc( * Method: allow2pc * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_allow2pc( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_allow2pc(JNIEnv*, jobject, jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_2pc); } @@ -7444,8 +7451,8 @@ jboolean Java_org_rocksdb_DBOptions_allow2pc( * Method: setRowCache * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setRowCache( - JNIEnv*, jobject, jlong jhandle, jlong jrow_cache_handle) { +void Java_org_rocksdb_DBOptions_setRowCache(JNIEnv*, jobject, jlong jhandle, + jlong jrow_cache_handle) { auto* opt = reinterpret_cast(jhandle); auto* row_cache = reinterpret_cast*>( @@ -7458,8 +7465,8 @@ void Java_org_rocksdb_DBOptions_setRowCache( * Method: setWalFilter * Signature: (JJ)V */ -void Java_org_rocksdb_DBOptions_setWalFilter( - JNIEnv*, jobject, jlong jhandle, jlong jwal_filter_handle) { +void Java_org_rocksdb_DBOptions_setWalFilter(JNIEnv*, jobject, jlong jhandle, + jlong jwal_filter_handle) { auto* opt = reinterpret_cast(jhandle); auto* wal_filter = reinterpret_cast( jwal_filter_handle); @@ -7483,8 +7490,8 @@ void Java_org_rocksdb_DBOptions_setFailIfOptionsFileError( * Method: failIfOptionsFileError * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_failIfOptionsFileError( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_failIfOptionsFileError(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->fail_if_options_file_error); } @@ -7505,8 +7512,8 @@ void Java_org_rocksdb_DBOptions_setDumpMallocStats( * Method: dumpMallocStats * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_dumpMallocStats( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_dumpMallocStats(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->dump_malloc_stats); } @@ -7528,8 +7535,8 @@ void Java_org_rocksdb_DBOptions_setAvoidFlushDuringRecovery( * Method: avoidFlushDuringRecovery * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringRecovery( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringRecovery(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_recovery); } @@ -7550,8 +7557,8 @@ void Java_org_rocksdb_DBOptions_setAllowIngestBehind( * Method: allowIngestBehind * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_allowIngestBehind( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_allowIngestBehind(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->allow_ingest_behind); } @@ -7561,8 +7568,9 @@ jboolean Java_org_rocksdb_DBOptions_allowIngestBehind( * Method: setTwoWriteQueues * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setTwoWriteQueues( - JNIEnv*, jobject, jlong jhandle, jboolean jtwo_write_queues) { +void Java_org_rocksdb_DBOptions_setTwoWriteQueues(JNIEnv*, jobject, + jlong jhandle, + jboolean jtwo_write_queues) { auto* opt = reinterpret_cast(jhandle); opt->two_write_queues = jtwo_write_queues == JNI_TRUE; } @@ -7572,8 +7580,8 @@ void Java_org_rocksdb_DBOptions_setTwoWriteQueues( * Method: twoWriteQueues * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_twoWriteQueues( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_twoWriteQueues(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->two_write_queues); } @@ -7583,8 +7591,9 @@ jboolean Java_org_rocksdb_DBOptions_twoWriteQueues( * Method: setManualWalFlush * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setManualWalFlush( - JNIEnv*, jobject, jlong jhandle, jboolean jmanual_wal_flush) { +void Java_org_rocksdb_DBOptions_setManualWalFlush(JNIEnv*, jobject, + jlong jhandle, + jboolean jmanual_wal_flush) { auto* opt = reinterpret_cast(jhandle); opt->manual_wal_flush = jmanual_wal_flush == JNI_TRUE; } @@ -7594,8 +7603,8 @@ void Java_org_rocksdb_DBOptions_setManualWalFlush( * Method: manualWalFlush * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_manualWalFlush( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_manualWalFlush(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->manual_wal_flush); } @@ -7605,8 +7614,8 @@ jboolean Java_org_rocksdb_DBOptions_manualWalFlush( * Method: setAtomicFlush * Signature: (JZ)V */ -void Java_org_rocksdb_DBOptions_setAtomicFlush( - JNIEnv*, jobject, jlong jhandle, jboolean jatomic_flush) { +void Java_org_rocksdb_DBOptions_setAtomicFlush(JNIEnv*, jobject, jlong jhandle, + jboolean jatomic_flush) { auto* opt = reinterpret_cast(jhandle); opt->atomic_flush = jatomic_flush == JNI_TRUE; } @@ -7616,8 +7625,8 @@ void Java_org_rocksdb_DBOptions_setAtomicFlush( * Method: atomicFlush * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_atomicFlush( - JNIEnv *, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_atomicFlush(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->atomic_flush); } @@ -7639,8 +7648,8 @@ void Java_org_rocksdb_DBOptions_setAvoidFlushDuringShutdown( * Method: avoidFlushDuringShutdown * Signature: (J)Z */ -jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringShutdown( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringShutdown(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->avoid_flush_during_shutdown); } @@ -7809,8 +7818,7 @@ jlong Java_org_rocksdb_DBOptions_bgerrorResumeRetryInterval(JNIEnv*, jclass, * Method: newWriteOptions * Signature: ()J */ -jlong Java_org_rocksdb_WriteOptions_newWriteOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_WriteOptions_newWriteOptions(JNIEnv*, jclass) { auto* op = new ROCKSDB_NAMESPACE::WriteOptions(); return GET_CPLUSPLUS_POINTER(op); } @@ -7820,8 +7828,8 @@ jlong Java_org_rocksdb_WriteOptions_newWriteOptions( * Method: copyWriteOptions * Signature: (J)J */ -jlong Java_org_rocksdb_WriteOptions_copyWriteOptions( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_WriteOptions_copyWriteOptions(JNIEnv*, jclass, + jlong jhandle) { auto new_opt = new ROCKSDB_NAMESPACE::WriteOptions( *(reinterpret_cast(jhandle))); return GET_CPLUSPLUS_POINTER(new_opt); @@ -7832,8 +7840,8 @@ jlong Java_org_rocksdb_WriteOptions_copyWriteOptions( * Method: disposeInternal * Signature: ()V */ -void Java_org_rocksdb_WriteOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_WriteOptions_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* write_options = reinterpret_cast(jhandle); assert(write_options != nullptr); @@ -7845,8 +7853,8 @@ void Java_org_rocksdb_WriteOptions_disposeInternal( * Method: setSync * Signature: (JZ)V */ -void Java_org_rocksdb_WriteOptions_setSync( - JNIEnv*, jobject, jlong jhandle, jboolean jflag) { +void Java_org_rocksdb_WriteOptions_setSync(JNIEnv*, jobject, jlong jhandle, + jboolean jflag) { reinterpret_cast(jhandle)->sync = jflag; } @@ -7855,8 +7863,7 @@ void Java_org_rocksdb_WriteOptions_setSync( * Method: sync * Signature: (J)Z */ -jboolean Java_org_rocksdb_WriteOptions_sync( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_WriteOptions_sync(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->sync; } @@ -7865,8 +7872,9 @@ jboolean Java_org_rocksdb_WriteOptions_sync( * Method: setDisableWAL * Signature: (JZ)V */ -void Java_org_rocksdb_WriteOptions_setDisableWAL( - JNIEnv*, jobject, jlong jhandle, jboolean jflag) { +void Java_org_rocksdb_WriteOptions_setDisableWAL(JNIEnv*, jobject, + jlong jhandle, + jboolean jflag) { reinterpret_cast(jhandle)->disableWAL = jflag; } @@ -7876,8 +7884,8 @@ void Java_org_rocksdb_WriteOptions_setDisableWAL( * Method: disableWAL * Signature: (J)Z */ -jboolean Java_org_rocksdb_WriteOptions_disableWAL( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_WriteOptions_disableWAL(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->disableWAL; } @@ -7888,8 +7896,7 @@ jboolean Java_org_rocksdb_WriteOptions_disableWAL( * Signature: (JZ)V */ void Java_org_rocksdb_WriteOptions_setIgnoreMissingColumnFamilies( - JNIEnv*, jobject, jlong jhandle, - jboolean jignore_missing_column_families) { + JNIEnv*, jobject, jlong jhandle, jboolean jignore_missing_column_families) { reinterpret_cast(jhandle) ->ignore_missing_column_families = static_cast(jignore_missing_column_families); @@ -7911,8 +7918,9 @@ jboolean Java_org_rocksdb_WriteOptions_ignoreMissingColumnFamilies( * Method: setNoSlowdown * Signature: (JZ)V */ -void Java_org_rocksdb_WriteOptions_setNoSlowdown( - JNIEnv*, jobject, jlong jhandle, jboolean jno_slowdown) { +void Java_org_rocksdb_WriteOptions_setNoSlowdown(JNIEnv*, jobject, + jlong jhandle, + jboolean jno_slowdown) { reinterpret_cast(jhandle)->no_slowdown = static_cast(jno_slowdown); } @@ -7922,8 +7930,8 @@ void Java_org_rocksdb_WriteOptions_setNoSlowdown( * Method: noSlowdown * Signature: (J)Z */ -jboolean Java_org_rocksdb_WriteOptions_noSlowdown( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_WriteOptions_noSlowdown(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->no_slowdown; } @@ -7933,8 +7941,8 @@ jboolean Java_org_rocksdb_WriteOptions_noSlowdown( * Method: setLowPri * Signature: (JZ)V */ -void Java_org_rocksdb_WriteOptions_setLowPri( - JNIEnv*, jobject, jlong jhandle, jboolean jlow_pri) { +void Java_org_rocksdb_WriteOptions_setLowPri(JNIEnv*, jobject, jlong jhandle, + jboolean jlow_pri) { reinterpret_cast(jhandle)->low_pri = static_cast(jlow_pri); } @@ -7944,8 +7952,7 @@ void Java_org_rocksdb_WriteOptions_setLowPri( * Method: lowPri * Signature: (J)Z */ -jboolean Java_org_rocksdb_WriteOptions_lowPri( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_WriteOptions_lowPri(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->low_pri; } @@ -7980,8 +7987,7 @@ void Java_org_rocksdb_WriteOptions_setMemtableInsertHintPerBatch( * Method: newReadOptions * Signature: ()J */ -jlong Java_org_rocksdb_ReadOptions_newReadOptions__( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_ReadOptions_newReadOptions__(JNIEnv*, jclass) { auto* read_options = new ROCKSDB_NAMESPACE::ReadOptions(); return GET_CPLUSPLUS_POINTER(read_options); } @@ -8003,8 +8009,8 @@ jlong Java_org_rocksdb_ReadOptions_newReadOptions__ZZ( * Method: copyReadOptions * Signature: (J)J */ -jlong Java_org_rocksdb_ReadOptions_copyReadOptions( - JNIEnv*, jclass, jlong jhandle) { +jlong Java_org_rocksdb_ReadOptions_copyReadOptions(JNIEnv*, jclass, + jlong jhandle) { auto new_opt = new ROCKSDB_NAMESPACE::ReadOptions( *(reinterpret_cast(jhandle))); return GET_CPLUSPLUS_POINTER(new_opt); @@ -8015,8 +8021,8 @@ jlong Java_org_rocksdb_ReadOptions_copyReadOptions( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_ReadOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_ReadOptions_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* read_options = reinterpret_cast(jhandle); assert(read_options != nullptr); @@ -8039,8 +8045,8 @@ void Java_org_rocksdb_ReadOptions_setVerifyChecksums( * Method: verifyChecksums * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_verifyChecksums( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_verifyChecksums(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->verify_checksums; } @@ -8050,8 +8056,8 @@ jboolean Java_org_rocksdb_ReadOptions_verifyChecksums( * Method: setFillCache * Signature: (JZ)V */ -void Java_org_rocksdb_ReadOptions_setFillCache( - JNIEnv*, jobject, jlong jhandle, jboolean jfill_cache) { +void Java_org_rocksdb_ReadOptions_setFillCache(JNIEnv*, jobject, jlong jhandle, + jboolean jfill_cache) { reinterpret_cast(jhandle)->fill_cache = static_cast(jfill_cache); } @@ -8061,8 +8067,8 @@ void Java_org_rocksdb_ReadOptions_setFillCache( * Method: fillCache * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_fillCache( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_fillCache(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle)->fill_cache; } @@ -8071,8 +8077,8 @@ jboolean Java_org_rocksdb_ReadOptions_fillCache( * Method: setTailing * Signature: (JZ)V */ -void Java_org_rocksdb_ReadOptions_setTailing( - JNIEnv*, jobject, jlong jhandle, jboolean jtailing) { +void Java_org_rocksdb_ReadOptions_setTailing(JNIEnv*, jobject, jlong jhandle, + jboolean jtailing) { reinterpret_cast(jhandle)->tailing = static_cast(jtailing); } @@ -8082,8 +8088,7 @@ void Java_org_rocksdb_ReadOptions_setTailing( * Method: tailing * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_tailing( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_tailing(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->tailing; } @@ -8092,8 +8097,7 @@ jboolean Java_org_rocksdb_ReadOptions_tailing( * Method: managed * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_managed( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_managed(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->managed; } @@ -8102,8 +8106,8 @@ jboolean Java_org_rocksdb_ReadOptions_managed( * Method: setManaged * Signature: (JZ)V */ -void Java_org_rocksdb_ReadOptions_setManaged( - JNIEnv*, jobject, jlong jhandle, jboolean jmanaged) { +void Java_org_rocksdb_ReadOptions_setManaged(JNIEnv*, jobject, jlong jhandle, + jboolean jmanaged) { reinterpret_cast(jhandle)->managed = static_cast(jmanaged); } @@ -8113,8 +8117,8 @@ void Java_org_rocksdb_ReadOptions_setManaged( * Method: totalOrderSeek * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_totalOrderSeek( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_totalOrderSeek(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->total_order_seek; } @@ -8135,8 +8139,8 @@ void Java_org_rocksdb_ReadOptions_setTotalOrderSeek( * Method: prefixSameAsStart * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_prefixSameAsStart( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_prefixSameAsStart(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle) ->prefix_same_as_start; } @@ -8157,8 +8161,7 @@ void Java_org_rocksdb_ReadOptions_setPrefixSameAsStart( * Method: pinData * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_pinData( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_pinData(JNIEnv*, jobject, jlong jhandle) { return reinterpret_cast(jhandle)->pin_data; } @@ -8167,8 +8170,8 @@ jboolean Java_org_rocksdb_ReadOptions_pinData( * Method: setPinData * Signature: (JZ)V */ -void Java_org_rocksdb_ReadOptions_setPinData( - JNIEnv*, jobject, jlong jhandle, jboolean jpin_data) { +void Java_org_rocksdb_ReadOptions_setPinData(JNIEnv*, jobject, jlong jhandle, + jboolean jpin_data) { reinterpret_cast(jhandle)->pin_data = static_cast(jpin_data); } @@ -8202,8 +8205,8 @@ void Java_org_rocksdb_ReadOptions_setBackgroundPurgeOnIteratorCleanup( * Method: readaheadSize * Signature: (J)J */ -jlong Java_org_rocksdb_ReadOptions_readaheadSize( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ReadOptions_readaheadSize(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->readahead_size); } @@ -8213,8 +8216,9 @@ jlong Java_org_rocksdb_ReadOptions_readaheadSize( * Method: setReadaheadSize * Signature: (JJ)V */ -void Java_org_rocksdb_ReadOptions_setReadaheadSize( - JNIEnv*, jobject, jlong jhandle, jlong jreadahead_size) { +void Java_org_rocksdb_ReadOptions_setReadaheadSize(JNIEnv*, jobject, + jlong jhandle, + jlong jreadahead_size) { auto* opt = reinterpret_cast(jhandle); opt->readahead_size = static_cast(jreadahead_size); } @@ -8224,8 +8228,8 @@ void Java_org_rocksdb_ReadOptions_setReadaheadSize( * Method: maxSkippableInternalKeys * Signature: (J)J */ -jlong Java_org_rocksdb_ReadOptions_maxSkippableInternalKeys( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ReadOptions_maxSkippableInternalKeys(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->max_skippable_internal_keys); } @@ -8247,8 +8251,8 @@ void Java_org_rocksdb_ReadOptions_setMaxSkippableInternalKeys( * Method: ignoreRangeDeletions * Signature: (J)Z */ -jboolean Java_org_rocksdb_ReadOptions_ignoreRangeDeletions( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ReadOptions_ignoreRangeDeletions(JNIEnv*, jobject, + jlong jhandle) { auto* opt = reinterpret_cast(jhandle); return static_cast(opt->ignore_range_deletions); } @@ -8269,8 +8273,8 @@ void Java_org_rocksdb_ReadOptions_setIgnoreRangeDeletions( * Method: setSnapshot * Signature: (JJ)V */ -void Java_org_rocksdb_ReadOptions_setSnapshot( - JNIEnv*, jobject, jlong jhandle, jlong jsnapshot) { +void Java_org_rocksdb_ReadOptions_setSnapshot(JNIEnv*, jobject, jlong jhandle, + jlong jsnapshot) { reinterpret_cast(jhandle)->snapshot = reinterpret_cast(jsnapshot); } @@ -8280,8 +8284,7 @@ void Java_org_rocksdb_ReadOptions_setSnapshot( * Method: snapshot * Signature: (J)J */ -jlong Java_org_rocksdb_ReadOptions_snapshot( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ReadOptions_snapshot(JNIEnv*, jobject, jlong jhandle) { auto& snapshot = reinterpret_cast(jhandle)->snapshot; return GET_CPLUSPLUS_POINTER(snapshot); @@ -8292,8 +8295,7 @@ jlong Java_org_rocksdb_ReadOptions_snapshot( * Method: readTier * Signature: (J)B */ -jbyte Java_org_rocksdb_ReadOptions_readTier( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_ReadOptions_readTier(JNIEnv*, jobject, jlong jhandle) { return static_cast( reinterpret_cast(jhandle)->read_tier); } @@ -8303,8 +8305,8 @@ jbyte Java_org_rocksdb_ReadOptions_readTier( * Method: setReadTier * Signature: (JB)V */ -void Java_org_rocksdb_ReadOptions_setReadTier( - JNIEnv*, jobject, jlong jhandle, jbyte jread_tier) { +void Java_org_rocksdb_ReadOptions_setReadTier(JNIEnv*, jobject, jlong jhandle, + jbyte jread_tier) { reinterpret_cast(jhandle)->read_tier = static_cast(jread_tier); } @@ -8326,8 +8328,8 @@ void Java_org_rocksdb_ReadOptions_setIterateUpperBound( * Method: iterateUpperBound * Signature: (J)J */ -jlong Java_org_rocksdb_ReadOptions_iterateUpperBound( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ReadOptions_iterateUpperBound(JNIEnv*, jobject, + jlong jhandle) { auto& upper_bound_slice_handle = reinterpret_cast(jhandle) ->iterate_upper_bound; @@ -8351,8 +8353,8 @@ void Java_org_rocksdb_ReadOptions_setIterateLowerBound( * Method: iterateLowerBound * Signature: (J)J */ -jlong Java_org_rocksdb_ReadOptions_iterateLowerBound( - JNIEnv*, jobject, jlong jhandle) { +jlong Java_org_rocksdb_ReadOptions_iterateLowerBound(JNIEnv*, jobject, + jlong jhandle) { auto& lower_bound_slice_handle = reinterpret_cast(jhandle) ->iterate_lower_bound; @@ -8516,8 +8518,7 @@ void Java_org_rocksdb_ReadOptions_setValueSizeSoftLimit( * Method: newComparatorOptions * Signature: ()J */ -jlong Java_org_rocksdb_ComparatorOptions_newComparatorOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_ComparatorOptions_newComparatorOptions(JNIEnv*, jclass) { auto* comparator_opt = new ROCKSDB_NAMESPACE::ComparatorJniCallbackOptions(); return GET_CPLUSPLUS_POINTER(comparator_opt); } @@ -8528,7 +8529,7 @@ jlong Java_org_rocksdb_ComparatorOptions_newComparatorOptions( * Signature: (J)B */ jbyte Java_org_rocksdb_ComparatorOptions_reusedSynchronisationType( - JNIEnv *, jobject, jlong jhandle) { + JNIEnv*, jobject, jlong jhandle) { auto* comparator_opt = reinterpret_cast( jhandle); @@ -8557,8 +8558,8 @@ void Java_org_rocksdb_ComparatorOptions_setReusedSynchronisationType( * Method: useDirectBuffer * Signature: (J)Z */ -jboolean Java_org_rocksdb_ComparatorOptions_useDirectBuffer( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_ComparatorOptions_useDirectBuffer(JNIEnv*, jobject, + jlong jhandle) { return static_cast( reinterpret_cast( jhandle) @@ -8581,8 +8582,8 @@ void Java_org_rocksdb_ComparatorOptions_setUseDirectBuffer( * Method: maxReusedBufferSize * Signature: (J)I */ -jint Java_org_rocksdb_ComparatorOptions_maxReusedBufferSize( - JNIEnv*, jobject, jlong jhandle) { +jint Java_org_rocksdb_ComparatorOptions_maxReusedBufferSize(JNIEnv*, jobject, + jlong jhandle) { return static_cast( reinterpret_cast( jhandle) @@ -8605,8 +8606,8 @@ void Java_org_rocksdb_ComparatorOptions_setMaxReusedBufferSize( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_ComparatorOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_ComparatorOptions_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* comparator_opt = reinterpret_cast( jhandle); @@ -8622,8 +8623,7 @@ void Java_org_rocksdb_ComparatorOptions_disposeInternal( * Method: newFlushOptions * Signature: ()J */ -jlong Java_org_rocksdb_FlushOptions_newFlushOptions( - JNIEnv*, jclass) { +jlong Java_org_rocksdb_FlushOptions_newFlushOptions(JNIEnv*, jclass) { auto* flush_opt = new ROCKSDB_NAMESPACE::FlushOptions(); return GET_CPLUSPLUS_POINTER(flush_opt); } @@ -8633,8 +8633,9 @@ jlong Java_org_rocksdb_FlushOptions_newFlushOptions( * Method: setWaitForFlush * Signature: (JZ)V */ -void Java_org_rocksdb_FlushOptions_setWaitForFlush( - JNIEnv*, jobject, jlong jhandle, jboolean jwait) { +void Java_org_rocksdb_FlushOptions_setWaitForFlush(JNIEnv*, jobject, + jlong jhandle, + jboolean jwait) { reinterpret_cast(jhandle)->wait = static_cast(jwait); } @@ -8644,8 +8645,8 @@ void Java_org_rocksdb_FlushOptions_setWaitForFlush( * Method: waitForFlush * Signature: (J)Z */ -jboolean Java_org_rocksdb_FlushOptions_waitForFlush( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_FlushOptions_waitForFlush(JNIEnv*, jobject, + jlong jhandle) { return reinterpret_cast(jhandle)->wait; } @@ -8666,8 +8667,8 @@ void Java_org_rocksdb_FlushOptions_setAllowWriteStall( * Method: allowWriteStall * Signature: (J)Z */ -jboolean Java_org_rocksdb_FlushOptions_allowWriteStall( - JNIEnv*, jobject, jlong jhandle) { +jboolean Java_org_rocksdb_FlushOptions_allowWriteStall(JNIEnv*, jobject, + jlong jhandle) { auto* flush_options = reinterpret_cast(jhandle); return static_cast(flush_options->allow_write_stall); @@ -8678,8 +8679,8 @@ jboolean Java_org_rocksdb_FlushOptions_allowWriteStall( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_FlushOptions_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_FlushOptions_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* flush_opt = reinterpret_cast(jhandle); assert(flush_opt != nullptr); delete flush_opt; diff --git a/java/rocksjni/options_util.cc b/java/rocksjni/options_util.cc index f529c548b..1a5fb9bb5 100644 --- a/java/rocksjni/options_util.cc +++ b/java/rocksjni/options_util.cc @@ -6,14 +6,15 @@ // This file implements the "bridge" between Java and C++ and enables // calling C++ ROCKSDB_NAMESPACE::OptionsUtil methods from Java side. +#include "rocksdb/utilities/options_util.h" + #include + #include #include "include/org_rocksdb_OptionsUtil.h" - #include "rocksdb/db.h" #include "rocksdb/env.h" -#include "rocksdb/utilities/options_util.h" #include "rocksjni/portal.h" void build_column_family_descriptor_list( diff --git a/java/rocksjni/persistent_cache.cc b/java/rocksjni/persistent_cache.cc index ff930a74e..295d91798 100644 --- a/java/rocksjni/persistent_cache.cc +++ b/java/rocksjni/persistent_cache.cc @@ -23,8 +23,8 @@ * Signature: (JLjava/lang/String;JJZ)J */ jlong Java_org_rocksdb_PersistentCache_newPersistentCache( - JNIEnv* env, jclass, jlong jenv_handle, jstring jpath, - jlong jsz, jlong jlogger_handle, jboolean joptimized_for_nvm) { + JNIEnv* env, jclass, jlong jenv_handle, jstring jpath, jlong jsz, + jlong jlogger_handle, jboolean joptimized_for_nvm) { auto* rocks_env = reinterpret_cast(jenv_handle); jboolean has_exception = JNI_FALSE; std::string path = @@ -51,8 +51,8 @@ jlong Java_org_rocksdb_PersistentCache_newPersistentCache( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_PersistentCache_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_PersistentCache_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* cache = reinterpret_cast*>( jhandle); diff --git a/java/rocksjni/portal.h b/java/rocksjni/portal.h index 28c341949..02a426262 100644 --- a/java/rocksjni/portal.h +++ b/java/rocksjni/portal.h @@ -73,14 +73,13 @@ class JavaClass { }; // Native class template -template class RocksDBNativeClass : public JavaClass { -}; +template +class RocksDBNativeClass : public JavaClass {}; // Native class template for sub-classes of RocksMutableObject -template class NativeRocksMutableObject - : public RocksDBNativeClass { +template +class NativeRocksMutableObject : public RocksDBNativeClass { public: - /** * Gets the Java Method ID for the * RocksMutableObject#setNativeHandle(long, boolean) method @@ -92,12 +91,11 @@ template class NativeRocksMutableObject */ static jmethodID getSetNativeHandleMethod(JNIEnv* env) { static jclass jclazz = DERIVED::getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "setNativeHandle", "(JZ)V"); + static jmethodID mid = env->GetMethodID(jclazz, "setNativeHandle", "(JZ)V"); assert(mid != nullptr); return mid; } @@ -114,16 +112,16 @@ template class NativeRocksMutableObject * @return true if a Java exception is pending, false otherwise */ static bool setHandle(JNIEnv* env, jobject jobj, PTR ptr, - jboolean java_owns_handle) { + jboolean java_owns_handle) { assert(jobj != nullptr); static jmethodID mid = getSetNativeHandleMethod(env); - if(mid == nullptr) { + if (mid == nullptr) { return true; // signal exception } env->CallVoidMethod(jobj, mid, GET_CPLUSPLUS_POINTER(ptr), java_owns_handle); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { return true; // signal exception } @@ -132,7 +130,8 @@ template class NativeRocksMutableObject }; // Java Exception template -template class JavaException : public JavaClass { +template +class JavaException : public JavaClass { public: /** * Create and throw a java exception with the provided message @@ -144,16 +143,18 @@ template class JavaException : public JavaClass { */ static bool ThrowNew(JNIEnv* env, const std::string& msg) { jclass jclazz = DERIVED::getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class - std::cerr << "JavaException::ThrowNew - Error: unexpected exception!" << std::endl; + std::cerr << "JavaException::ThrowNew - Error: unexpected exception!" + << std::endl; return env->ExceptionCheck(); } const jint rs = env->ThrowNew(jclazz, msg.c_str()); - if(rs != JNI_OK) { + if (rs != JNI_OK) { // exception could not be thrown - std::cerr << "JavaException::ThrowNew - Fatal: could not throw exception!" << std::endl; + std::cerr << "JavaException::ThrowNew - Fatal: could not throw exception!" + << std::endl; return env->ExceptionCheck(); } @@ -162,8 +163,8 @@ template class JavaException : public JavaClass { }; // The portal class for java.lang.IllegalArgumentException -class IllegalArgumentExceptionJni : - public JavaException { +class IllegalArgumentExceptionJni + : public JavaException { public: /** * Get the Java Class java.lang.IllegalArgumentException @@ -196,9 +197,11 @@ class IllegalArgumentExceptionJni : // get the IllegalArgumentException class jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class - std::cerr << "IllegalArgumentExceptionJni::ThrowNew/class - Error: unexpected exception!" << std::endl; + std::cerr << "IllegalArgumentExceptionJni::ThrowNew/class - Error: " + "unexpected exception!" + << std::endl; return env->ExceptionCheck(); } @@ -232,13 +235,12 @@ class CodeJni : public JavaClass { */ static jmethodID getValueMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = - env->GetMethodID(jclazz, "getValue", "()b"); + static jmethodID mid = env->GetMethodID(jclazz, "getValue", "()b"); assert(mid != nullptr); return mid; } @@ -270,13 +272,12 @@ class SubCodeJni : public JavaClass { */ static jmethodID getValueMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = - env->GetMethodID(jclazz, "getValue", "()b"); + static jmethodID mid = env->GetMethodID(jclazz, "getValue", "()b"); assert(mid != nullptr); return mid; } @@ -335,7 +336,7 @@ class StatusJni */ static jmethodID getCodeMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -356,13 +357,13 @@ class StatusJni */ static jmethodID getSubCodeMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = - env->GetMethodID(jclazz, "getSubCode", "()Lorg/rocksdb/Status$SubCode;"); + static jmethodID mid = env->GetMethodID(jclazz, "getSubCode", + "()Lorg/rocksdb/Status$SubCode;"); assert(mid != nullptr); return mid; } @@ -377,7 +378,7 @@ class StatusJni */ static jmethodID getStateMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -400,14 +401,14 @@ class StatusJni */ static jobject construct(JNIEnv* env, const Status& status) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } jmethodID mid = env->GetMethodID(jclazz, "", "(BBLjava/lang/String;)V"); - if(mid == nullptr) { + if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; } @@ -417,8 +418,8 @@ class StatusJni if (status.getState() != nullptr) { const char* const state = status.getState(); jstate = env->NewStringUTF(state); - if(env->ExceptionCheck()) { - if(jstate != nullptr) { + if (env->ExceptionCheck()) { + if (jstate != nullptr) { env->DeleteLocalRef(jstate); } return nullptr; @@ -427,16 +428,16 @@ class StatusJni jobject jstatus = env->NewObject(jclazz, mid, toJavaStatusCode(status.code()), - toJavaStatusSubCode(status.subcode()), jstate); - if(env->ExceptionCheck()) { + toJavaStatusSubCode(status.subcode()), jstate); + if (env->ExceptionCheck()) { // exception occurred - if(jstate != nullptr) { + if (jstate != nullptr) { env->DeleteLocalRef(jstate); } return nullptr; } - if(jstate != nullptr) { + if (jstate != nullptr) { env->DeleteLocalRef(jstate); } @@ -517,24 +518,24 @@ class StatusJni std::unique_ptr status; switch (jcode_value) { case 0x0: - //Ok + // Ok status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::OK())); break; case 0x1: - //NotFound + // NotFound status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::NotFound( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x2: - //Corruption + // Corruption status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Corruption( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x3: - //NotSupported + // NotSupported status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status( ROCKSDB_NAMESPACE::Status::NotSupported( @@ -542,7 +543,7 @@ class StatusJni jsub_code_value)))); break; case 0x4: - //InvalidArgument + // InvalidArgument status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status( ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -550,13 +551,13 @@ class StatusJni jsub_code_value)))); break; case 0x5: - //IOError + // IOError status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::IOError( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x6: - //MergeInProgress + // MergeInProgress status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status( ROCKSDB_NAMESPACE::Status::MergeInProgress( @@ -564,13 +565,13 @@ class StatusJni jsub_code_value)))); break; case 0x7: - //Incomplete + // Incomplete status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Incomplete( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0x8: - //ShutdownInProgress + // ShutdownInProgress status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status( ROCKSDB_NAMESPACE::Status::ShutdownInProgress( @@ -578,31 +579,31 @@ class StatusJni jsub_code_value)))); break; case 0x9: - //TimedOut + // TimedOut status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::TimedOut( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xA: - //Aborted + // Aborted status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Aborted( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xB: - //Busy + // Busy status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Busy( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xC: - //Expired + // Expired status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::Expired( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); break; case 0xD: - //TryAgain + // TryAgain status = std::unique_ptr( new ROCKSDB_NAMESPACE::Status(ROCKSDB_NAMESPACE::Status::TryAgain( ROCKSDB_NAMESPACE::SubCodeJni::toCppSubCode(jsub_code_value)))); @@ -719,8 +720,7 @@ class StatusJni }; // The portal class for org.rocksdb.RocksDBException -class RocksDBExceptionJni : - public JavaException { +class RocksDBExceptionJni : public JavaException { public: /** * Get the Java Class org.rocksdb.RocksDBException @@ -778,60 +778,71 @@ class RocksDBExceptionJni : // get the RocksDBException class jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class - std::cerr << "RocksDBExceptionJni::ThrowNew/class - Error: unexpected exception!" << std::endl; + std::cerr << "RocksDBExceptionJni::ThrowNew/class - Error: unexpected " + "exception!" + << std::endl; return env->ExceptionCheck(); } // get the constructor of org.rocksdb.RocksDBException jmethodID mid = env->GetMethodID(jclazz, "", "(Lorg/rocksdb/Status;)V"); - if(mid == nullptr) { + if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError - std::cerr << "RocksDBExceptionJni::ThrowNew/cstr - Error: unexpected exception!" << std::endl; + std::cerr + << "RocksDBExceptionJni::ThrowNew/cstr - Error: unexpected exception!" + << std::endl; return env->ExceptionCheck(); } // get the Java status object jobject jstatus = StatusJni::construct(env, s); - if(jstatus == nullptr) { + if (jstatus == nullptr) { // exception occcurred - std::cerr << "RocksDBExceptionJni::ThrowNew/StatusJni - Error: unexpected exception!" << std::endl; + std::cerr << "RocksDBExceptionJni::ThrowNew/StatusJni - Error: " + "unexpected exception!" + << std::endl; return env->ExceptionCheck(); } // construct the RocksDBException - jthrowable rocksdb_exception = reinterpret_cast(env->NewObject(jclazz, mid, jstatus)); - if(env->ExceptionCheck()) { - if(jstatus != nullptr) { + jthrowable rocksdb_exception = + reinterpret_cast(env->NewObject(jclazz, mid, jstatus)); + if (env->ExceptionCheck()) { + if (jstatus != nullptr) { env->DeleteLocalRef(jstatus); } - if(rocksdb_exception != nullptr) { + if (rocksdb_exception != nullptr) { env->DeleteLocalRef(rocksdb_exception); } - std::cerr << "RocksDBExceptionJni::ThrowNew/NewObject - Error: unexpected exception!" << std::endl; + std::cerr << "RocksDBExceptionJni::ThrowNew/NewObject - Error: " + "unexpected exception!" + << std::endl; return true; } // throw the RocksDBException const jint rs = env->Throw(rocksdb_exception); - if(rs != JNI_OK) { + if (rs != JNI_OK) { // exception could not be thrown - std::cerr << "RocksDBExceptionJni::ThrowNew - Fatal: could not throw exception!" << std::endl; - if(jstatus != nullptr) { + std::cerr + << "RocksDBExceptionJni::ThrowNew - Fatal: could not throw exception!" + << std::endl; + if (jstatus != nullptr) { env->DeleteLocalRef(jstatus); } - if(rocksdb_exception != nullptr) { + if (rocksdb_exception != nullptr) { env->DeleteLocalRef(rocksdb_exception); } return env->ExceptionCheck(); } - if(jstatus != nullptr) { + if (jstatus != nullptr) { env->DeleteLocalRef(jstatus); } - if(rocksdb_exception != nullptr) { + if (rocksdb_exception != nullptr) { env->DeleteLocalRef(rocksdb_exception); } @@ -858,79 +869,92 @@ class RocksDBExceptionJni : // get the RocksDBException class jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class - std::cerr << "RocksDBExceptionJni::ThrowNew/class - Error: unexpected exception!" << std::endl; + std::cerr << "RocksDBExceptionJni::ThrowNew/class - Error: unexpected " + "exception!" + << std::endl; return env->ExceptionCheck(); } // get the constructor of org.rocksdb.RocksDBException - jmethodID mid = - env->GetMethodID(jclazz, "", "(Ljava/lang/String;Lorg/rocksdb/Status;)V"); - if(mid == nullptr) { + jmethodID mid = env->GetMethodID( + jclazz, "", "(Ljava/lang/String;Lorg/rocksdb/Status;)V"); + if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError - std::cerr << "RocksDBExceptionJni::ThrowNew/cstr - Error: unexpected exception!" << std::endl; + std::cerr + << "RocksDBExceptionJni::ThrowNew/cstr - Error: unexpected exception!" + << std::endl; return env->ExceptionCheck(); } jstring jmsg = env->NewStringUTF(msg.c_str()); - if(jmsg == nullptr) { + if (jmsg == nullptr) { // exception thrown: OutOfMemoryError - std::cerr << "RocksDBExceptionJni::ThrowNew/msg - Error: unexpected exception!" << std::endl; + std::cerr + << "RocksDBExceptionJni::ThrowNew/msg - Error: unexpected exception!" + << std::endl; return env->ExceptionCheck(); } // get the Java status object jobject jstatus = StatusJni::construct(env, s); - if(jstatus == nullptr) { + if (jstatus == nullptr) { // exception occcurred - std::cerr << "RocksDBExceptionJni::ThrowNew/StatusJni - Error: unexpected exception!" << std::endl; - if(jmsg != nullptr) { + std::cerr << "RocksDBExceptionJni::ThrowNew/StatusJni - Error: " + "unexpected exception!" + << std::endl; + if (jmsg != nullptr) { env->DeleteLocalRef(jmsg); } return env->ExceptionCheck(); } // construct the RocksDBException - jthrowable rocksdb_exception = reinterpret_cast(env->NewObject(jclazz, mid, jmsg, jstatus)); - if(env->ExceptionCheck()) { - if(jstatus != nullptr) { + jthrowable rocksdb_exception = reinterpret_cast( + env->NewObject(jclazz, mid, jmsg, jstatus)); + if (env->ExceptionCheck()) { + if (jstatus != nullptr) { env->DeleteLocalRef(jstatus); } - if(jmsg != nullptr) { + if (jmsg != nullptr) { env->DeleteLocalRef(jmsg); } - if(rocksdb_exception != nullptr) { + if (rocksdb_exception != nullptr) { env->DeleteLocalRef(rocksdb_exception); } - std::cerr << "RocksDBExceptionJni::ThrowNew/NewObject - Error: unexpected exception!" << std::endl; + std::cerr << "RocksDBExceptionJni::ThrowNew/NewObject - Error: " + "unexpected exception!" + << std::endl; return true; } // throw the RocksDBException const jint rs = env->Throw(rocksdb_exception); - if(rs != JNI_OK) { + if (rs != JNI_OK) { // exception could not be thrown - std::cerr << "RocksDBExceptionJni::ThrowNew - Fatal: could not throw exception!" << std::endl; - if(jstatus != nullptr) { + std::cerr + << "RocksDBExceptionJni::ThrowNew - Fatal: could not throw exception!" + << std::endl; + if (jstatus != nullptr) { env->DeleteLocalRef(jstatus); } - if(jmsg != nullptr) { + if (jmsg != nullptr) { env->DeleteLocalRef(jmsg); } - if(rocksdb_exception != nullptr) { + if (rocksdb_exception != nullptr) { env->DeleteLocalRef(rocksdb_exception); } return env->ExceptionCheck(); } - if(jstatus != nullptr) { + if (jstatus != nullptr) { env->DeleteLocalRef(jstatus); } - if(jmsg != nullptr) { + if (jmsg != nullptr) { env->DeleteLocalRef(jmsg); } - if(rocksdb_exception != nullptr) { + if (rocksdb_exception != nullptr) { env->DeleteLocalRef(rocksdb_exception); } @@ -947,7 +971,7 @@ class RocksDBExceptionJni : */ static jmethodID getStatusMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -960,26 +984,26 @@ class RocksDBExceptionJni : static std::unique_ptr toCppStatus( JNIEnv* env, jthrowable jrocksdb_exception) { - if(!env->IsInstanceOf(jrocksdb_exception, getJClass(env))) { + if (!env->IsInstanceOf(jrocksdb_exception, getJClass(env))) { // not an instance of RocksDBException return nullptr; } // get the java status object jmethodID mid = getStatusMethod(env); - if(mid == nullptr) { + if (mid == nullptr) { // exception occurred accessing class or method return nullptr; } jobject jstatus = env->CallObjectMethod(jrocksdb_exception, mid); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception occurred return nullptr; } - if(jstatus == nullptr) { - return nullptr; // no status available + if (jstatus == nullptr) { + return nullptr; // no status available } return ROCKSDB_NAMESPACE::StatusJni::toCppStatus(env, jstatus); @@ -1038,7 +1062,7 @@ class ListJni : public JavaClass { */ static jmethodID getIteratorMethod(JNIEnv* env) { jclass jlist_clazz = getListClass(env); - if(jlist_clazz == nullptr) { + if (jlist_clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1059,7 +1083,7 @@ class ListJni : public JavaClass { */ static jmethodID getHasNextMethod(JNIEnv* env) { jclass jiterator_clazz = getIteratorClass(env); - if(jiterator_clazz == nullptr) { + if (jiterator_clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1079,7 +1103,7 @@ class ListJni : public JavaClass { */ static jmethodID getNextMethod(JNIEnv* env) { jclass jiterator_clazz = getIteratorClass(env); - if(jiterator_clazz == nullptr) { + if (jiterator_clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1100,7 +1124,7 @@ class ListJni : public JavaClass { */ static jmethodID getArrayListConstructorMethodId(JNIEnv* env) { jclass jarray_list_clazz = getArrayListClass(env); - if(jarray_list_clazz == nullptr) { + if (jarray_list_clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1120,7 +1144,7 @@ class ListJni : public JavaClass { */ static jmethodID getListAddMethodId(JNIEnv* env) { jclass jlist_clazz = getListClass(env); - if(jlist_clazz == nullptr) { + if (jlist_clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1171,7 +1195,7 @@ class ByteJni : public JavaClass { */ static jobjectArray new2dByteArray(JNIEnv* env, const jsize len) { jclass clazz = getArrayJClass(env); - if(clazz == nullptr) { + if (clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1189,7 +1213,7 @@ class ByteJni : public JavaClass { */ static jmethodID getByteValueMethod(JNIEnv* env) { jclass clazz = getJClass(env); - if(clazz == nullptr) { + if (clazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1204,8 +1228,8 @@ class ByteJni : public JavaClass { * * @param env A pointer to the Java environment * - * @return A constructing Byte object or nullptr if the class or method id could not - * be retrieved, or an exception occurred + * @return A constructing Byte object or nullptr if the class or method id + * could not be retrieved, or an exception occurred */ static jobject valueOf(JNIEnv* env, jbyte jprimitive_byte) { jclass clazz = getJClass(env); @@ -1230,7 +1254,6 @@ class ByteJni : public JavaClass { return jbyte_obj; } - }; // The portal class for java.nio.ByteBuffer @@ -1260,7 +1283,7 @@ class ByteBufferJni : public JavaClass { * be retrieved */ static jmethodID getAllocateMethodId(JNIEnv* env, - jclass jbytebuffer_clazz = nullptr) { + jclass jbytebuffer_clazz = nullptr) { const jclass jclazz = jbytebuffer_clazz == nullptr ? getJClass(env) : jbytebuffer_clazz; if (jclazz == nullptr) { @@ -1268,8 +1291,8 @@ class ByteBufferJni : public JavaClass { return nullptr; } - static jmethodID mid = env->GetStaticMethodID( - jclazz, "allocate", "(I)Ljava/nio/ByteBuffer;"); + static jmethodID mid = + env->GetStaticMethodID(jclazz, "allocate", "(I)Ljava/nio/ByteBuffer;"); assert(mid != nullptr); return mid; } @@ -1283,10 +1306,10 @@ class ByteBufferJni : public JavaClass { * be retrieved */ static jmethodID getArrayMethodId(JNIEnv* env, - jclass jbytebuffer_clazz = nullptr) { + jclass jbytebuffer_clazz = nullptr) { const jclass jclazz = jbytebuffer_clazz == nullptr ? getJClass(env) : jbytebuffer_clazz; - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -1296,9 +1319,9 @@ class ByteBufferJni : public JavaClass { return mid; } - static jobject construct( - JNIEnv* env, const bool direct, const size_t capacity, - jclass jbytebuffer_clazz = nullptr) { + static jobject construct(JNIEnv* env, const bool direct, + const size_t capacity, + jclass jbytebuffer_clazz = nullptr) { return constructWith(env, direct, nullptr, capacity, jbytebuffer_clazz); } @@ -1311,7 +1334,8 @@ class ByteBufferJni : public JavaClass { buf = new char[capacity]; allocated = true; } - jobject jbuf = env->NewDirectByteBuffer(const_cast(buf), static_cast(capacity)); + jobject jbuf = env->NewDirectByteBuffer(const_cast(buf), + static_cast(capacity)); if (jbuf == nullptr) { // exception occurred if (allocated) { @@ -1322,14 +1346,16 @@ class ByteBufferJni : public JavaClass { return jbuf; } else { const jclass jclazz = - jbytebuffer_clazz == nullptr ? getJClass(env) : jbytebuffer_clazz; + jbytebuffer_clazz == nullptr ? getJClass(env) : jbytebuffer_clazz; if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - const jmethodID jmid_allocate = getAllocateMethodId(env, jbytebuffer_clazz); + const jmethodID jmid_allocate = + getAllocateMethodId(env, jbytebuffer_clazz); if (jmid_allocate == nullptr) { - // exception occurred accessing class, or NoSuchMethodException or OutOfMemoryError + // exception occurred accessing class, or NoSuchMethodException or + // OutOfMemoryError return nullptr; } const jobject jbuf = env->CallStaticObjectMethod( @@ -1353,9 +1379,9 @@ class ByteBufferJni : public JavaClass { env->GetPrimitiveArrayCritical(jarray, &is_copy)); if (ja == nullptr) { // exception occurred - env->DeleteLocalRef(jarray); - env->DeleteLocalRef(jbuf); - return nullptr; + env->DeleteLocalRef(jarray); + env->DeleteLocalRef(jbuf); + return nullptr; } memcpy(ja, const_cast(buf), capacity); @@ -1370,10 +1396,11 @@ class ByteBufferJni : public JavaClass { } static jbyteArray array(JNIEnv* env, const jobject& jbyte_buffer, - jclass jbytebuffer_clazz = nullptr) { + jclass jbytebuffer_clazz = nullptr) { const jmethodID mid = getArrayMethodId(env, jbytebuffer_clazz); if (mid == nullptr) { - // exception occurred accessing class, or NoSuchMethodException or OutOfMemoryError + // exception occurred accessing class, or NoSuchMethodException or + // OutOfMemoryError return nullptr; } const jobject jarray = env->CallObjectMethod(jbyte_buffer, mid); @@ -1469,7 +1496,7 @@ class LongJni : public JavaClass { // The portal class for java.lang.StringBuilder class StringBuilderJni : public JavaClass { - public: + public: /** * Get the Java Class java.lang.StringBuilder * @@ -1493,14 +1520,13 @@ class StringBuilderJni : public JavaClass { */ static jmethodID getListAddMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = - env->GetMethodID(jclazz, "append", - "(Ljava/lang/String;)Ljava/lang/StringBuilder;"); + static jmethodID mid = env->GetMethodID( + jclazz, "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;"); assert(mid != nullptr); return mid; } @@ -1516,22 +1542,22 @@ class StringBuilderJni : public JavaClass { * an exception occurs */ static jobject append(JNIEnv* env, jobject jstring_builder, - const char* c_str) { + const char* c_str) { jmethodID mid = getListAddMethodId(env); - if(mid == nullptr) { + if (mid == nullptr) { // exception occurred accessing class or method return nullptr; } jstring new_value_str = env->NewStringUTF(c_str); - if(new_value_str == nullptr) { + if (new_value_str == nullptr) { // exception thrown: OutOfMemoryError return nullptr; } jobject jresult_string_builder = env->CallObjectMethod(jstring_builder, mid, new_value_str); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception occurred env->DeleteLocalRef(new_value_str); return nullptr; @@ -1544,846 +1570,863 @@ class StringBuilderJni : public JavaClass { // various utility functions for working with RocksDB and JNI class JniUtil { public: - /** - * Detect if jlong overflows size_t - * - * @param jvalue the jlong value - * - * @return - */ - inline static Status check_if_jlong_fits_size_t(const jlong& jvalue) { - Status s = Status::OK(); - if (static_cast(jvalue) > std::numeric_limits::max()) { - s = Status::InvalidArgument(Slice("jlong overflows 32 bit value.")); - } - return s; - } - - /** - * Obtains a reference to the JNIEnv from - * the JVM - * - * If the current thread is not attached to the JavaVM - * then it will be attached so as to retrieve the JNIEnv - * - * If a thread is attached, it must later be manually - * released by calling JavaVM::DetachCurrentThread. - * This can be handled by always matching calls to this - * function with calls to {@link JniUtil::releaseJniEnv(JavaVM*, jboolean)} - * - * @param jvm (IN) A pointer to the JavaVM instance - * @param attached (OUT) A pointer to a boolean which - * will be set to JNI_TRUE if we had to attach the thread - * - * @return A pointer to the JNIEnv or nullptr if a fatal error - * occurs and the JNIEnv cannot be retrieved - */ - static JNIEnv* getJniEnv(JavaVM* jvm, jboolean* attached) { - assert(jvm != nullptr); - - JNIEnv *env; - const jint env_rs = jvm->GetEnv(reinterpret_cast(&env), - JNI_VERSION_1_6); - - if(env_rs == JNI_OK) { - // current thread is already attached, return the JNIEnv - *attached = JNI_FALSE; + /** + * Detect if jlong overflows size_t + * + * @param jvalue the jlong value + * + * @return + */ + inline static Status check_if_jlong_fits_size_t(const jlong& jvalue) { + Status s = Status::OK(); + if (static_cast(jvalue) > std::numeric_limits::max()) { + s = Status::InvalidArgument(Slice("jlong overflows 32 bit value.")); + } + return s; + } + + /** + * Obtains a reference to the JNIEnv from + * the JVM + * + * If the current thread is not attached to the JavaVM + * then it will be attached so as to retrieve the JNIEnv + * + * If a thread is attached, it must later be manually + * released by calling JavaVM::DetachCurrentThread. + * This can be handled by always matching calls to this + * function with calls to {@link JniUtil::releaseJniEnv(JavaVM*, jboolean)} + * + * @param jvm (IN) A pointer to the JavaVM instance + * @param attached (OUT) A pointer to a boolean which + * will be set to JNI_TRUE if we had to attach the thread + * + * @return A pointer to the JNIEnv or nullptr if a fatal error + * occurs and the JNIEnv cannot be retrieved + */ + static JNIEnv* getJniEnv(JavaVM* jvm, jboolean* attached) { + assert(jvm != nullptr); + + JNIEnv* env; + const jint env_rs = + jvm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6); + + if (env_rs == JNI_OK) { + // current thread is already attached, return the JNIEnv + *attached = JNI_FALSE; + return env; + } else if (env_rs == JNI_EDETACHED) { + // current thread is not attached, attempt to attach + const jint rs_attach = + jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); + if (rs_attach == JNI_OK) { + *attached = JNI_TRUE; return env; - } else if(env_rs == JNI_EDETACHED) { - // current thread is not attached, attempt to attach - const jint rs_attach = jvm->AttachCurrentThread(reinterpret_cast(&env), NULL); - if(rs_attach == JNI_OK) { - *attached = JNI_TRUE; - return env; - } else { - // error, could not attach the thread - std::cerr << "JniUtil::getJniEnv - Fatal: could not attach current thread to JVM!" << std::endl; - return nullptr; - } - } else if(env_rs == JNI_EVERSION) { - // error, JDK does not support JNI_VERSION_1_6+ - std::cerr << "JniUtil::getJniEnv - Fatal: JDK does not support JNI_VERSION_1_6" << std::endl; - return nullptr; } else { - std::cerr << "JniUtil::getJniEnv - Fatal: Unknown error: env_rs=" << env_rs << std::endl; + // error, could not attach the thread + std::cerr << "JniUtil::getJniEnv - Fatal: could not attach current " + "thread to JVM!" + << std::endl; return nullptr; } + } else if (env_rs == JNI_EVERSION) { + // error, JDK does not support JNI_VERSION_1_6+ + std::cerr + << "JniUtil::getJniEnv - Fatal: JDK does not support JNI_VERSION_1_6" + << std::endl; + return nullptr; + } else { + std::cerr << "JniUtil::getJniEnv - Fatal: Unknown error: env_rs=" + << env_rs << std::endl; + return nullptr; } + } - /** - * Counterpart to {@link JniUtil::getJniEnv(JavaVM*, jboolean*)} - * - * Detachess the current thread from the JVM if it was previously - * attached - * - * @param jvm (IN) A pointer to the JavaVM instance - * @param attached (IN) JNI_TRUE if we previously had to attach the thread - * to the JavaVM to get the JNIEnv - */ - static void releaseJniEnv(JavaVM* jvm, jboolean& attached) { - assert(jvm != nullptr); - if(attached == JNI_TRUE) { - const jint rs_detach = jvm->DetachCurrentThread(); - assert(rs_detach == JNI_OK); - if(rs_detach != JNI_OK) { - std::cerr << "JniUtil::getJniEnv - Warn: Unable to detach current thread from JVM!" << std::endl; - } + /** + * Counterpart to {@link JniUtil::getJniEnv(JavaVM*, jboolean*)} + * + * Detachess the current thread from the JVM if it was previously + * attached + * + * @param jvm (IN) A pointer to the JavaVM instance + * @param attached (IN) JNI_TRUE if we previously had to attach the thread + * to the JavaVM to get the JNIEnv + */ + static void releaseJniEnv(JavaVM* jvm, jboolean& attached) { + assert(jvm != nullptr); + if (attached == JNI_TRUE) { + const jint rs_detach = jvm->DetachCurrentThread(); + assert(rs_detach == JNI_OK); + if (rs_detach != JNI_OK) { + std::cerr << "JniUtil::getJniEnv - Warn: Unable to detach current " + "thread from JVM!" + << std::endl; } } + } - /** - * Copies a Java String[] to a C++ std::vector - * - * @param env (IN) A pointer to the java environment - * @param jss (IN) The Java String array to copy - * @param has_exception (OUT) will be set to JNI_TRUE - * if an OutOfMemoryError or ArrayIndexOutOfBoundsException - * exception occurs - * - * @return A std::vector containing copies of the Java strings - */ - static std::vector copyStrings(JNIEnv* env, - jobjectArray jss, jboolean* has_exception) { - return ROCKSDB_NAMESPACE::JniUtil::copyStrings( - env, jss, env->GetArrayLength(jss), has_exception); - } - - /** - * Copies a Java String[] to a C++ std::vector - * - * @param env (IN) A pointer to the java environment - * @param jss (IN) The Java String array to copy - * @param jss_len (IN) The length of the Java String array to copy - * @param has_exception (OUT) will be set to JNI_TRUE - * if an OutOfMemoryError or ArrayIndexOutOfBoundsException - * exception occurs - * - * @return A std::vector containing copies of the Java strings - */ - static std::vector copyStrings(JNIEnv* env, - jobjectArray jss, const jsize jss_len, jboolean* has_exception) { - std::vector strs; - strs.reserve(jss_len); - for (jsize i = 0; i < jss_len; i++) { - jobject js = env->GetObjectArrayElement(jss, i); - if(env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - *has_exception = JNI_TRUE; - return strs; - } - - jstring jstr = static_cast(js); - const char* str = env->GetStringUTFChars(jstr, nullptr); - if(str == nullptr) { - // exception thrown: OutOfMemoryError - env->DeleteLocalRef(js); - *has_exception = JNI_TRUE; - return strs; - } - - strs.push_back(std::string(str)); + /** + * Copies a Java String[] to a C++ std::vector + * + * @param env (IN) A pointer to the java environment + * @param jss (IN) The Java String array to copy + * @param has_exception (OUT) will be set to JNI_TRUE + * if an OutOfMemoryError or ArrayIndexOutOfBoundsException + * exception occurs + * + * @return A std::vector containing copies of the Java strings + */ + static std::vector copyStrings(JNIEnv* env, jobjectArray jss, + jboolean* has_exception) { + return ROCKSDB_NAMESPACE::JniUtil::copyStrings( + env, jss, env->GetArrayLength(jss), has_exception); + } - env->ReleaseStringUTFChars(jstr, str); - env->DeleteLocalRef(js); + /** + * Copies a Java String[] to a C++ std::vector + * + * @param env (IN) A pointer to the java environment + * @param jss (IN) The Java String array to copy + * @param jss_len (IN) The length of the Java String array to copy + * @param has_exception (OUT) will be set to JNI_TRUE + * if an OutOfMemoryError or ArrayIndexOutOfBoundsException + * exception occurs + * + * @return A std::vector containing copies of the Java strings + */ + static std::vector copyStrings(JNIEnv* env, jobjectArray jss, + const jsize jss_len, + jboolean* has_exception) { + std::vector strs; + strs.reserve(jss_len); + for (jsize i = 0; i < jss_len; i++) { + jobject js = env->GetObjectArrayElement(jss, i); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + *has_exception = JNI_TRUE; + return strs; } - *has_exception = JNI_FALSE; - return strs; - } - - /** - * Copies a jstring to a C-style null-terminated byte string - * and releases the original jstring - * - * The jstring is copied as UTF-8 - * - * If an exception occurs, then JNIEnv::ExceptionCheck() - * will have been called - * - * @param env (IN) A pointer to the java environment - * @param js (IN) The java string to copy - * @param has_exception (OUT) will be set to JNI_TRUE - * if an OutOfMemoryError exception occurs - * - * @return A pointer to the copied string, or a - * nullptr if has_exception == JNI_TRUE - */ - static std::unique_ptr copyString(JNIEnv* env, jstring js, - jboolean* has_exception) { - const char *utf = env->GetStringUTFChars(js, nullptr); - if(utf == nullptr) { + jstring jstr = static_cast(js); + const char* str = env->GetStringUTFChars(jstr, nullptr); + if (str == nullptr) { // exception thrown: OutOfMemoryError - env->ExceptionCheck(); - *has_exception = JNI_TRUE; - return nullptr; - } else if(env->ExceptionCheck()) { - // exception thrown - env->ReleaseStringUTFChars(js, utf); + env->DeleteLocalRef(js); *has_exception = JNI_TRUE; - return nullptr; + return strs; } - const jsize utf_len = env->GetStringUTFLength(js); - std::unique_ptr str(new char[utf_len + 1]); // Note: + 1 is needed for the c_str null terminator - std::strcpy(str.get(), utf); + strs.push_back(std::string(str)); + + env->ReleaseStringUTFChars(jstr, str); + env->DeleteLocalRef(js); + } + + *has_exception = JNI_FALSE; + return strs; + } + + /** + * Copies a jstring to a C-style null-terminated byte string + * and releases the original jstring + * + * The jstring is copied as UTF-8 + * + * If an exception occurs, then JNIEnv::ExceptionCheck() + * will have been called + * + * @param env (IN) A pointer to the java environment + * @param js (IN) The java string to copy + * @param has_exception (OUT) will be set to JNI_TRUE + * if an OutOfMemoryError exception occurs + * + * @return A pointer to the copied string, or a + * nullptr if has_exception == JNI_TRUE + */ + static std::unique_ptr copyString(JNIEnv* env, jstring js, + jboolean* has_exception) { + const char* utf = env->GetStringUTFChars(js, nullptr); + if (utf == nullptr) { + // exception thrown: OutOfMemoryError + env->ExceptionCheck(); + *has_exception = JNI_TRUE; + return nullptr; + } else if (env->ExceptionCheck()) { + // exception thrown env->ReleaseStringUTFChars(js, utf); - *has_exception = JNI_FALSE; - return str; - } - - /** - * Copies a jstring to a std::string - * and releases the original jstring - * - * If an exception occurs, then JNIEnv::ExceptionCheck() - * will have been called - * - * @param env (IN) A pointer to the java environment - * @param js (IN) The java string to copy - * @param has_exception (OUT) will be set to JNI_TRUE - * if an OutOfMemoryError exception occurs - * - * @return A std:string copy of the jstring, or an - * empty std::string if has_exception == JNI_TRUE - */ - static std::string copyStdString(JNIEnv* env, jstring js, - jboolean* has_exception) { - const char *utf = env->GetStringUTFChars(js, nullptr); - if(utf == nullptr) { - // exception thrown: OutOfMemoryError - env->ExceptionCheck(); - *has_exception = JNI_TRUE; - return std::string(); - } else if(env->ExceptionCheck()) { - // exception thrown - env->ReleaseStringUTFChars(js, utf); - *has_exception = JNI_TRUE; - return std::string(); - } + *has_exception = JNI_TRUE; + return nullptr; + } + + const jsize utf_len = env->GetStringUTFLength(js); + std::unique_ptr str( + new char[utf_len + + 1]); // Note: + 1 is needed for the c_str null terminator + std::strcpy(str.get(), utf); + env->ReleaseStringUTFChars(js, utf); + *has_exception = JNI_FALSE; + return str; + } - std::string name(utf); + /** + * Copies a jstring to a std::string + * and releases the original jstring + * + * If an exception occurs, then JNIEnv::ExceptionCheck() + * will have been called + * + * @param env (IN) A pointer to the java environment + * @param js (IN) The java string to copy + * @param has_exception (OUT) will be set to JNI_TRUE + * if an OutOfMemoryError exception occurs + * + * @return A std:string copy of the jstring, or an + * empty std::string if has_exception == JNI_TRUE + */ + static std::string copyStdString(JNIEnv* env, jstring js, + jboolean* has_exception) { + const char* utf = env->GetStringUTFChars(js, nullptr); + if (utf == nullptr) { + // exception thrown: OutOfMemoryError + env->ExceptionCheck(); + *has_exception = JNI_TRUE; + return std::string(); + } else if (env->ExceptionCheck()) { + // exception thrown env->ReleaseStringUTFChars(js, utf); - *has_exception = JNI_FALSE; - return name; - } - - /** - * Copies bytes from a std::string to a jByteArray - * - * @param env A pointer to the java environment - * @param bytes The bytes to copy - * - * @return the Java byte[], or nullptr if an exception occurs - * - * @throws RocksDBException thrown - * if memory size to copy exceeds general java specific array size limitation. - */ - static jbyteArray copyBytes(JNIEnv* env, std::string bytes) { - return createJavaByteArrayWithSizeCheck(env, bytes.c_str(), bytes.size()); - } - - /** - * Given a Java byte[][] which is an array of java.lang.Strings - * where each String is a byte[], the passed function `string_fn` - * will be called on each String, the result is the collected by - * calling the passed function `collector_fn` - * - * @param env (IN) A pointer to the java environment - * @param jbyte_strings (IN) A Java array of Strings expressed as bytes - * @param string_fn (IN) A transform function to call for each String - * @param collector_fn (IN) A collector which is called for the result - * of each `string_fn` - * @param has_exception (OUT) will be set to JNI_TRUE - * if an ArrayIndexOutOfBoundsException or OutOfMemoryError - * exception occurs - */ - template static void byteStrings(JNIEnv* env, - jobjectArray jbyte_strings, - std::function string_fn, - std::function collector_fn, - jboolean *has_exception) { - const jsize jlen = env->GetArrayLength(jbyte_strings); - - for(jsize i = 0; i < jlen; i++) { - jobject jbyte_string_obj = env->GetObjectArrayElement(jbyte_strings, i); - if(env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - *has_exception = JNI_TRUE; // signal error - return; - } + *has_exception = JNI_TRUE; + return std::string(); + } - jbyteArray jbyte_string_ary = - reinterpret_cast(jbyte_string_obj); - T result = byteString(env, jbyte_string_ary, string_fn, has_exception); + std::string name(utf); + env->ReleaseStringUTFChars(js, utf); + *has_exception = JNI_FALSE; + return name; + } - env->DeleteLocalRef(jbyte_string_obj); + /** + * Copies bytes from a std::string to a jByteArray + * + * @param env A pointer to the java environment + * @param bytes The bytes to copy + * + * @return the Java byte[], or nullptr if an exception occurs + * + * @throws RocksDBException thrown + * if memory size to copy exceeds general java specific array size + * limitation. + */ + static jbyteArray copyBytes(JNIEnv* env, std::string bytes) { + return createJavaByteArrayWithSizeCheck(env, bytes.c_str(), bytes.size()); + } - if(*has_exception == JNI_TRUE) { - // exception thrown: OutOfMemoryError - return; - } + /** + * Given a Java byte[][] which is an array of java.lang.Strings + * where each String is a byte[], the passed function `string_fn` + * will be called on each String, the result is the collected by + * calling the passed function `collector_fn` + * + * @param env (IN) A pointer to the java environment + * @param jbyte_strings (IN) A Java array of Strings expressed as bytes + * @param string_fn (IN) A transform function to call for each String + * @param collector_fn (IN) A collector which is called for the result + * of each `string_fn` + * @param has_exception (OUT) will be set to JNI_TRUE + * if an ArrayIndexOutOfBoundsException or OutOfMemoryError + * exception occurs + */ + template + static void byteStrings(JNIEnv* env, jobjectArray jbyte_strings, + std::function string_fn, + std::function collector_fn, + jboolean* has_exception) { + const jsize jlen = env->GetArrayLength(jbyte_strings); - collector_fn(i, result); + for (jsize i = 0; i < jlen; i++) { + jobject jbyte_string_obj = env->GetObjectArrayElement(jbyte_strings, i); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + *has_exception = JNI_TRUE; // signal error + return; } - *has_exception = JNI_FALSE; - } - - /** - * Given a Java String which is expressed as a Java Byte Array byte[], - * the passed function `string_fn` will be called on the String - * and the result returned - * - * @param env (IN) A pointer to the java environment - * @param jbyte_string_ary (IN) A Java String expressed in bytes - * @param string_fn (IN) A transform function to call on the String - * @param has_exception (OUT) will be set to JNI_TRUE - * if an OutOfMemoryError exception occurs - */ - template static T byteString(JNIEnv* env, - jbyteArray jbyte_string_ary, - std::function string_fn, - jboolean* has_exception) { - const jsize jbyte_string_len = env->GetArrayLength(jbyte_string_ary); - return byteString(env, jbyte_string_ary, jbyte_string_len, string_fn, - has_exception); - } - - /** - * Given a Java String which is expressed as a Java Byte Array byte[], - * the passed function `string_fn` will be called on the String - * and the result returned - * - * @param env (IN) A pointer to the java environment - * @param jbyte_string_ary (IN) A Java String expressed in bytes - * @param jbyte_string_len (IN) The length of the Java String - * expressed in bytes - * @param string_fn (IN) A transform function to call on the String - * @param has_exception (OUT) will be set to JNI_TRUE - * if an OutOfMemoryError exception occurs - */ - template static T byteString(JNIEnv* env, - jbyteArray jbyte_string_ary, const jsize jbyte_string_len, - std::function string_fn, - jboolean* has_exception) { - jbyte* jbyte_string = - env->GetByteArrayElements(jbyte_string_ary, nullptr); - if(jbyte_string == nullptr) { + jbyteArray jbyte_string_ary = + reinterpret_cast(jbyte_string_obj); + T result = byteString(env, jbyte_string_ary, string_fn, has_exception); + + env->DeleteLocalRef(jbyte_string_obj); + + if (*has_exception == JNI_TRUE) { // exception thrown: OutOfMemoryError - *has_exception = JNI_TRUE; - return nullptr; // signal error + return; } - T result = - string_fn(reinterpret_cast(jbyte_string), jbyte_string_len); + collector_fn(i, result); + } - env->ReleaseByteArrayElements(jbyte_string_ary, jbyte_string, JNI_ABORT); + *has_exception = JNI_FALSE; + } - *has_exception = JNI_FALSE; - return result; + /** + * Given a Java String which is expressed as a Java Byte Array byte[], + * the passed function `string_fn` will be called on the String + * and the result returned + * + * @param env (IN) A pointer to the java environment + * @param jbyte_string_ary (IN) A Java String expressed in bytes + * @param string_fn (IN) A transform function to call on the String + * @param has_exception (OUT) will be set to JNI_TRUE + * if an OutOfMemoryError exception occurs + */ + template + static T byteString(JNIEnv* env, jbyteArray jbyte_string_ary, + std::function string_fn, + jboolean* has_exception) { + const jsize jbyte_string_len = env->GetArrayLength(jbyte_string_ary); + return byteString(env, jbyte_string_ary, jbyte_string_len, string_fn, + has_exception); + } + + /** + * Given a Java String which is expressed as a Java Byte Array byte[], + * the passed function `string_fn` will be called on the String + * and the result returned + * + * @param env (IN) A pointer to the java environment + * @param jbyte_string_ary (IN) A Java String expressed in bytes + * @param jbyte_string_len (IN) The length of the Java String + * expressed in bytes + * @param string_fn (IN) A transform function to call on the String + * @param has_exception (OUT) will be set to JNI_TRUE + * if an OutOfMemoryError exception occurs + */ + template + static T byteString(JNIEnv* env, jbyteArray jbyte_string_ary, + const jsize jbyte_string_len, + std::function string_fn, + jboolean* has_exception) { + jbyte* jbyte_string = env->GetByteArrayElements(jbyte_string_ary, nullptr); + if (jbyte_string == nullptr) { + // exception thrown: OutOfMemoryError + *has_exception = JNI_TRUE; + return nullptr; // signal error } - /** - * Converts a std::vector to a Java byte[][] where each Java String - * is expressed as a Java Byte Array byte[]. - * - * @param env A pointer to the java environment - * @param strings A vector of Strings - * - * @return A Java array of Strings expressed as bytes, - * or nullptr if an exception is thrown - */ - static jobjectArray stringsBytes(JNIEnv* env, std::vector strings) { - jclass jcls_ba = ByteJni::getArrayJClass(env); - if(jcls_ba == nullptr) { - // exception occurred - return nullptr; - } + T result = + string_fn(reinterpret_cast(jbyte_string), jbyte_string_len); - const jsize len = static_cast(strings.size()); + env->ReleaseByteArrayElements(jbyte_string_ary, jbyte_string, JNI_ABORT); - jobjectArray jbyte_strings = env->NewObjectArray(len, jcls_ba, nullptr); - if(jbyte_strings == nullptr) { - // exception thrown: OutOfMemoryError - return nullptr; - } + *has_exception = JNI_FALSE; + return result; + } - for (jsize i = 0; i < len; i++) { - std::string *str = &strings[i]; - const jsize str_len = static_cast(str->size()); + /** + * Converts a std::vector to a Java byte[][] where each Java String + * is expressed as a Java Byte Array byte[]. + * + * @param env A pointer to the java environment + * @param strings A vector of Strings + * + * @return A Java array of Strings expressed as bytes, + * or nullptr if an exception is thrown + */ + static jobjectArray stringsBytes(JNIEnv* env, + std::vector strings) { + jclass jcls_ba = ByteJni::getArrayJClass(env); + if (jcls_ba == nullptr) { + // exception occurred + return nullptr; + } - jbyteArray jbyte_string_ary = env->NewByteArray(str_len); - if(jbyte_string_ary == nullptr) { - // exception thrown: OutOfMemoryError - env->DeleteLocalRef(jbyte_strings); - return nullptr; - } + const jsize len = static_cast(strings.size()); - env->SetByteArrayRegion( - jbyte_string_ary, 0, str_len, - const_cast(reinterpret_cast(str->c_str()))); - if(env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - env->DeleteLocalRef(jbyte_string_ary); - env->DeleteLocalRef(jbyte_strings); - return nullptr; - } + jobjectArray jbyte_strings = env->NewObjectArray(len, jcls_ba, nullptr); + if (jbyte_strings == nullptr) { + // exception thrown: OutOfMemoryError + return nullptr; + } - env->SetObjectArrayElement(jbyte_strings, i, jbyte_string_ary); - if(env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - // or ArrayStoreException - env->DeleteLocalRef(jbyte_string_ary); - env->DeleteLocalRef(jbyte_strings); - return nullptr; - } + for (jsize i = 0; i < len; i++) { + std::string* str = &strings[i]; + const jsize str_len = static_cast(str->size()); - env->DeleteLocalRef(jbyte_string_ary); + jbyteArray jbyte_string_ary = env->NewByteArray(str_len); + if (jbyte_string_ary == nullptr) { + // exception thrown: OutOfMemoryError + env->DeleteLocalRef(jbyte_strings); + return nullptr; } - return jbyte_strings; - } - - /** - * Converts a std::vector to a Java String[]. - * - * @param env A pointer to the java environment - * @param strings A vector of Strings - * - * @return A Java array of Strings, - * or nullptr if an exception is thrown - */ - static jobjectArray toJavaStrings(JNIEnv* env, - const std::vector* strings) { - jclass jcls_str = env->FindClass("java/lang/String"); - if(jcls_str == nullptr) { - // exception occurred + env->SetByteArrayRegion( + jbyte_string_ary, 0, str_len, + const_cast(reinterpret_cast(str->c_str()))); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + env->DeleteLocalRef(jbyte_string_ary); + env->DeleteLocalRef(jbyte_strings); return nullptr; } - const jsize len = static_cast(strings->size()); - - jobjectArray jstrings = env->NewObjectArray(len, jcls_str, nullptr); - if(jstrings == nullptr) { - // exception thrown: OutOfMemoryError + env->SetObjectArrayElement(jbyte_strings, i, jbyte_string_ary); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + // or ArrayStoreException + env->DeleteLocalRef(jbyte_string_ary); + env->DeleteLocalRef(jbyte_strings); return nullptr; } - for (jsize i = 0; i < len; i++) { - const std::string *str = &((*strings)[i]); - jstring js = ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, str); - if (js == nullptr) { - env->DeleteLocalRef(jstrings); - return nullptr; - } + env->DeleteLocalRef(jbyte_string_ary); + } - env->SetObjectArrayElement(jstrings, i, js); - if(env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - // or ArrayStoreException - env->DeleteLocalRef(js); - env->DeleteLocalRef(jstrings); - return nullptr; - } - } + return jbyte_strings; + } - return jstrings; - } - - /** - * Creates a Java UTF String from a C++ std::string - * - * @param env A pointer to the java environment - * @param string the C++ std::string - * @param treat_empty_as_null true if empty strings should be treated as null - * - * @return the Java UTF string, or nullptr if the provided string - * is null (or empty and treat_empty_as_null is set), or if an - * exception occurs allocating the Java String. - */ - static jstring toJavaString(JNIEnv* env, const std::string* string, - const bool treat_empty_as_null = false) { - if (string == nullptr) { - return nullptr; - } + /** + * Converts a std::vector to a Java String[]. + * + * @param env A pointer to the java environment + * @param strings A vector of Strings + * + * @return A Java array of Strings, + * or nullptr if an exception is thrown + */ + static jobjectArray toJavaStrings(JNIEnv* env, + const std::vector* strings) { + jclass jcls_str = env->FindClass("java/lang/String"); + if (jcls_str == nullptr) { + // exception occurred + return nullptr; + } - if (treat_empty_as_null && string->empty()) { - return nullptr; - } + const jsize len = static_cast(strings->size()); - return env->NewStringUTF(string->c_str()); - } - - /** - * Copies bytes to a new jByteArray with the check of java array size limitation. - * - * @param bytes pointer to memory to copy to a new jByteArray - * @param size number of bytes to copy - * - * @return the Java byte[], or nullptr if an exception occurs - * - * @throws RocksDBException thrown - * if memory size to copy exceeds general java array size limitation to avoid overflow. - */ - static jbyteArray createJavaByteArrayWithSizeCheck(JNIEnv* env, const char* bytes, const size_t size) { - // Limitation for java array size is vm specific - // In general it cannot exceed Integer.MAX_VALUE (2^31 - 1) - // Current HotSpot VM limitation for array size is Integer.MAX_VALUE - 5 (2^31 - 1 - 5) - // It means that the next call to env->NewByteArray can still end with - // OutOfMemoryError("Requested array size exceeds VM limit") coming from VM - static const size_t MAX_JARRAY_SIZE = (static_cast(1)) << 31; - if(size > MAX_JARRAY_SIZE) { - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Requested array size exceeds VM limit"); - return nullptr; - } + jobjectArray jstrings = env->NewObjectArray(len, jcls_str, nullptr); + if (jstrings == nullptr) { + // exception thrown: OutOfMemoryError + return nullptr; + } - const jsize jlen = static_cast(size); - jbyteArray jbytes = env->NewByteArray(jlen); - if(jbytes == nullptr) { - // exception thrown: OutOfMemoryError + for (jsize i = 0; i < len; i++) { + const std::string* str = &((*strings)[i]); + jstring js = ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, str); + if (js == nullptr) { + env->DeleteLocalRef(jstrings); return nullptr; } - env->SetByteArrayRegion(jbytes, 0, jlen, - const_cast(reinterpret_cast(bytes))); - if(env->ExceptionCheck()) { + env->SetObjectArrayElement(jstrings, i, js); + if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException - env->DeleteLocalRef(jbytes); + // or ArrayStoreException + env->DeleteLocalRef(js); + env->DeleteLocalRef(jstrings); return nullptr; } + } - return jbytes; - } - - /** - * Copies bytes from a ROCKSDB_NAMESPACE::Slice to a jByteArray - * - * @param env A pointer to the java environment - * @param bytes The bytes to copy - * - * @return the Java byte[] or nullptr if an exception occurs - * - * @throws RocksDBException thrown - * if memory size to copy exceeds general java specific array size - * limitation. - */ - static jbyteArray copyBytes(JNIEnv* env, const Slice& bytes) { - return createJavaByteArrayWithSizeCheck(env, bytes.data(), bytes.size()); - } - - /* - * Helper for operations on a key and value - * for example WriteBatch->Put - * - * TODO(AR) could be used for RocksDB->Put etc. - */ - static std::unique_ptr kv_op( - std::function - op, - JNIEnv* env, jobject /*jobj*/, jbyteArray jkey, jint jkey_len, - jbyteArray jvalue, jint jvalue_len) { - jbyte* key = env->GetByteArrayElements(jkey, nullptr); - if(env->ExceptionCheck()) { - // exception thrown: OutOfMemoryError - return nullptr; - } + return jstrings; + } - jbyte* value = env->GetByteArrayElements(jvalue, nullptr); - if(env->ExceptionCheck()) { - // exception thrown: OutOfMemoryError - if(key != nullptr) { - env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); - } - return nullptr; - } + /** + * Creates a Java UTF String from a C++ std::string + * + * @param env A pointer to the java environment + * @param string the C++ std::string + * @param treat_empty_as_null true if empty strings should be treated as null + * + * @return the Java UTF string, or nullptr if the provided string + * is null (or empty and treat_empty_as_null is set), or if an + * exception occurs allocating the Java String. + */ + static jstring toJavaString(JNIEnv* env, const std::string* string, + const bool treat_empty_as_null = false) { + if (string == nullptr) { + return nullptr; + } - ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), - jkey_len); - ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), - jvalue_len); + if (treat_empty_as_null && string->empty()) { + return nullptr; + } - auto status = op(key_slice, value_slice); + return env->NewStringUTF(string->c_str()); + } - if(value != nullptr) { - env->ReleaseByteArrayElements(jvalue, value, JNI_ABORT); - } - if(key != nullptr) { - env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); - } + /** + * Copies bytes to a new jByteArray with the check of java array size + * limitation. + * + * @param bytes pointer to memory to copy to a new jByteArray + * @param size number of bytes to copy + * + * @return the Java byte[], or nullptr if an exception occurs + * + * @throws RocksDBException thrown + * if memory size to copy exceeds general java array size limitation to + * avoid overflow. + */ + static jbyteArray createJavaByteArrayWithSizeCheck(JNIEnv* env, + const char* bytes, + const size_t size) { + // Limitation for java array size is vm specific + // In general it cannot exceed Integer.MAX_VALUE (2^31 - 1) + // Current HotSpot VM limitation for array size is Integer.MAX_VALUE - 5 + // (2^31 - 1 - 5) It means that the next call to env->NewByteArray can still + // end with OutOfMemoryError("Requested array size exceeds VM limit") coming + // from VM + static const size_t MAX_JARRAY_SIZE = (static_cast(1)) << 31; + if (size > MAX_JARRAY_SIZE) { + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Requested array size exceeds VM limit"); + return nullptr; + } + + const jsize jlen = static_cast(size); + jbyteArray jbytes = env->NewByteArray(jlen); + if (jbytes == nullptr) { + // exception thrown: OutOfMemoryError + return nullptr; + } - return std::unique_ptr( - new ROCKSDB_NAMESPACE::Status(status)); + env->SetByteArrayRegion( + jbytes, 0, jlen, + const_cast(reinterpret_cast(bytes))); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + env->DeleteLocalRef(jbytes); + return nullptr; } - /* - * Helper for operations on a key - * for example WriteBatch->Delete - * - * TODO(AR) could be used for RocksDB->Delete etc. - */ - static std::unique_ptr k_op( - std::function op, - JNIEnv* env, jobject /*jobj*/, jbyteArray jkey, jint jkey_len) { - jbyte* key = env->GetByteArrayElements(jkey, nullptr); - if (env->ExceptionCheck()) { - // exception thrown: OutOfMemoryError - return nullptr; - } + return jbytes; + } - ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), - jkey_len); + /** + * Copies bytes from a ROCKSDB_NAMESPACE::Slice to a jByteArray + * + * @param env A pointer to the java environment + * @param bytes The bytes to copy + * + * @return the Java byte[] or nullptr if an exception occurs + * + * @throws RocksDBException thrown + * if memory size to copy exceeds general java specific array size + * limitation. + */ + static jbyteArray copyBytes(JNIEnv* env, const Slice& bytes) { + return createJavaByteArrayWithSizeCheck(env, bytes.data(), bytes.size()); + } - auto status = op(key_slice); + /* + * Helper for operations on a key and value + * for example WriteBatch->Put + * + * TODO(AR) could be used for RocksDB->Put etc. + */ + static std::unique_ptr kv_op( + std::function + op, + JNIEnv* env, jobject /*jobj*/, jbyteArray jkey, jint jkey_len, + jbyteArray jvalue, jint jvalue_len) { + jbyte* key = env->GetByteArrayElements(jkey, nullptr); + if (env->ExceptionCheck()) { + // exception thrown: OutOfMemoryError + return nullptr; + } + jbyte* value = env->GetByteArrayElements(jvalue, nullptr); + if (env->ExceptionCheck()) { + // exception thrown: OutOfMemoryError if (key != nullptr) { env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); } + return nullptr; + } - return std::unique_ptr( - new ROCKSDB_NAMESPACE::Status(status)); - } - - /* - * Helper for operations on a key which is a region of an array - * Used to extract the common code from seek/seekForPrev. - * Possible that it can be generalised from that. - * - * We use GetByteArrayRegion to copy the key region of the whole array into - * a char[] We suspect this is not much slower than GetByteArrayElements, - * which probably copies anyway. - */ - static void k_op_region(std::function op, - JNIEnv* env, jbyteArray jkey, jint jkey_off, - jint jkey_len) { - const std::unique_ptr key(new char[jkey_len]); - if (key == nullptr) { - jclass oom_class = env->FindClass("/lang/java/OutOfMemoryError"); - env->ThrowNew(oom_class, - "Memory allocation failed in RocksDB JNI function"); - return; - } - env->GetByteArrayRegion(jkey, jkey_off, jkey_len, - reinterpret_cast(key.get())); - if (env->ExceptionCheck()) { + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); + ROCKSDB_NAMESPACE::Slice value_slice(reinterpret_cast(value), + jvalue_len); + + auto status = op(key_slice, value_slice); + + if (value != nullptr) { + env->ReleaseByteArrayElements(jvalue, value, JNI_ABORT); + } + if (key != nullptr) { + env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); + } + + return std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(status)); + } + + /* + * Helper for operations on a key + * for example WriteBatch->Delete + * + * TODO(AR) could be used for RocksDB->Delete etc. + */ + static std::unique_ptr k_op( + std::function op, + JNIEnv* env, jobject /*jobj*/, jbyteArray jkey, jint jkey_len) { + jbyte* key = env->GetByteArrayElements(jkey, nullptr); + if (env->ExceptionCheck()) { + // exception thrown: OutOfMemoryError + return nullptr; + } + + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); + + auto status = op(key_slice); + + if (key != nullptr) { + env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); + } + + return std::unique_ptr( + new ROCKSDB_NAMESPACE::Status(status)); + } + + /* + * Helper for operations on a key which is a region of an array + * Used to extract the common code from seek/seekForPrev. + * Possible that it can be generalised from that. + * + * We use GetByteArrayRegion to copy the key region of the whole array into + * a char[] We suspect this is not much slower than GetByteArrayElements, + * which probably copies anyway. + */ + static void k_op_region(std::function op, + JNIEnv* env, jbyteArray jkey, jint jkey_off, + jint jkey_len) { + const std::unique_ptr key(new char[jkey_len]); + if (key == nullptr) { + jclass oom_class = env->FindClass("/lang/java/OutOfMemoryError"); + env->ThrowNew(oom_class, + "Memory allocation failed in RocksDB JNI function"); + return; + } + env->GetByteArrayRegion(jkey, jkey_off, jkey_len, + reinterpret_cast(key.get())); + if (env->ExceptionCheck()) { + // exception thrown: OutOfMemoryError + return; + } + + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key.get()), + jkey_len); + op(key_slice); + } + + /* + * Helper for operations on a value + * for example WriteBatchWithIndex->GetFromBatch + */ + static jbyteArray v_op(std::function + op, + JNIEnv* env, jbyteArray jkey, jint jkey_len) { + jbyte* key = env->GetByteArrayElements(jkey, nullptr); + if (env->ExceptionCheck()) { + // exception thrown: OutOfMemoryError + return nullptr; + } + + ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), jkey_len); + + std::string value; + ROCKSDB_NAMESPACE::Status s = op(key_slice, &value); + + if (key != nullptr) { + env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); + } + + if (s.IsNotFound()) { + return nullptr; + } + + if (s.ok()) { + jbyteArray jret_value = + env->NewByteArray(static_cast(value.size())); + if (jret_value == nullptr) { // exception thrown: OutOfMemoryError - return; + return nullptr; } - ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key.get()), - jkey_len); - op(key_slice); - } - - /* - * Helper for operations on a value - * for example WriteBatchWithIndex->GetFromBatch - */ - static jbyteArray v_op(std::function - op, - JNIEnv* env, jbyteArray jkey, jint jkey_len) { - jbyte* key = env->GetByteArrayElements(jkey, nullptr); - if(env->ExceptionCheck()) { - // exception thrown: OutOfMemoryError + env->SetByteArrayRegion( + jret_value, 0, static_cast(value.size()), + const_cast(reinterpret_cast(value.c_str()))); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + if (jret_value != nullptr) { + env->DeleteLocalRef(jret_value); + } return nullptr; } - ROCKSDB_NAMESPACE::Slice key_slice(reinterpret_cast(key), - jkey_len); + return jret_value; + } - std::string value; - ROCKSDB_NAMESPACE::Status s = op(key_slice, &value); + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); + return nullptr; + } - if(key != nullptr) { - env->ReleaseByteArrayElements(jkey, key, JNI_ABORT); - } + /** + * Creates a vector of C++ pointers from + * a Java array of C++ pointer addresses. + * + * @param env (IN) A pointer to the java environment + * @param pointers (IN) A Java array of C++ pointer addresses + * @param has_exception (OUT) will be set to JNI_TRUE + * if an ArrayIndexOutOfBoundsException or OutOfMemoryError + * exception occurs. + * + * @return A vector of C++ pointers. + */ + template + static std::vector fromJPointers(JNIEnv* env, jlongArray jptrs, + jboolean* has_exception) { + const jsize jptrs_len = env->GetArrayLength(jptrs); + std::vector ptrs; + jlong* jptr = env->GetLongArrayElements(jptrs, nullptr); + if (jptr == nullptr) { + // exception thrown: OutOfMemoryError + *has_exception = JNI_TRUE; + return ptrs; + } + ptrs.reserve(jptrs_len); + for (jsize i = 0; i < jptrs_len; i++) { + ptrs.push_back(reinterpret_cast(jptr[i])); + } + env->ReleaseLongArrayElements(jptrs, jptr, JNI_ABORT); + return ptrs; + } - if (s.IsNotFound()) { - return nullptr; - } + /** + * Creates a Java array of C++ pointer addresses + * from a vector of C++ pointers. + * + * @param env (IN) A pointer to the java environment + * @param pointers (IN) A vector of C++ pointers + * @param has_exception (OUT) will be set to JNI_TRUE + * if an ArrayIndexOutOfBoundsException or OutOfMemoryError + * exception occurs + * + * @return Java array of C++ pointer addresses. + */ + template + static jlongArray toJPointers(JNIEnv* env, const std::vector& pointers, + jboolean* has_exception) { + const jsize len = static_cast(pointers.size()); + std::unique_ptr results(new jlong[len]); + std::transform( + pointers.begin(), pointers.end(), results.get(), + [](T* pointer) -> jlong { return GET_CPLUSPLUS_POINTER(pointer); }); - if (s.ok()) { - jbyteArray jret_value = - env->NewByteArray(static_cast(value.size())); - if(jret_value == nullptr) { - // exception thrown: OutOfMemoryError - return nullptr; - } + jlongArray jpointers = env->NewLongArray(len); + if (jpointers == nullptr) { + // exception thrown: OutOfMemoryError + *has_exception = JNI_TRUE; + return nullptr; + } - env->SetByteArrayRegion(jret_value, 0, static_cast(value.size()), - const_cast(reinterpret_cast(value.c_str()))); - if(env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - if(jret_value != nullptr) { - env->DeleteLocalRef(jret_value); - } - return nullptr; - } + env->SetLongArrayRegion(jpointers, 0, len, results.get()); + if (env->ExceptionCheck()) { + // exception thrown: ArrayIndexOutOfBoundsException + *has_exception = JNI_TRUE; + env->DeleteLocalRef(jpointers); + return nullptr; + } - return jret_value; - } + *has_exception = JNI_FALSE; + + return jpointers; + } + + /* + * Helper for operations on a key and value + * for example WriteBatch->Put + * + * TODO(AR) could be extended to cover returning ROCKSDB_NAMESPACE::Status + * from `op` and used for RocksDB->Put etc. + */ + static void kv_op_direct( + std::function + op, + JNIEnv* env, jobject jkey, jint jkey_off, jint jkey_len, jobject jval, + jint jval_off, jint jval_len) { + char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); + if (key == nullptr || + env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, + "Invalid key argument"); + return; + } - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); - return nullptr; - } - - /** - * Creates a vector of C++ pointers from - * a Java array of C++ pointer addresses. - * - * @param env (IN) A pointer to the java environment - * @param pointers (IN) A Java array of C++ pointer addresses - * @param has_exception (OUT) will be set to JNI_TRUE - * if an ArrayIndexOutOfBoundsException or OutOfMemoryError - * exception occurs. - * - * @return A vector of C++ pointers. - */ - template static std::vector fromJPointers( - JNIEnv* env, jlongArray jptrs, jboolean *has_exception) { - const jsize jptrs_len = env->GetArrayLength(jptrs); - std::vector ptrs; - jlong* jptr = env->GetLongArrayElements(jptrs, nullptr); - if (jptr == nullptr) { - // exception thrown: OutOfMemoryError - *has_exception = JNI_TRUE; - return ptrs; - } - ptrs.reserve(jptrs_len); - for (jsize i = 0; i < jptrs_len; i++) { - ptrs.push_back(reinterpret_cast(jptr[i])); - } - env->ReleaseLongArrayElements(jptrs, jptr, JNI_ABORT); - return ptrs; + char* value = reinterpret_cast(env->GetDirectBufferAddress(jval)); + if (value == nullptr || + env->GetDirectBufferCapacity(jval) < (jval_off + jval_len)) { + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Invalid value argument"); + return; } - /** - * Creates a Java array of C++ pointer addresses - * from a vector of C++ pointers. - * - * @param env (IN) A pointer to the java environment - * @param pointers (IN) A vector of C++ pointers - * @param has_exception (OUT) will be set to JNI_TRUE - * if an ArrayIndexOutOfBoundsException or OutOfMemoryError - * exception occurs - * - * @return Java array of C++ pointer addresses. - */ - template static jlongArray toJPointers(JNIEnv* env, - const std::vector &pointers, - jboolean *has_exception) { - const jsize len = static_cast(pointers.size()); - std::unique_ptr results(new jlong[len]); - std::transform( - pointers.begin(), pointers.end(), results.get(), - [](T* pointer) -> jlong { return GET_CPLUSPLUS_POINTER(pointer); }); - - jlongArray jpointers = env->NewLongArray(len); - if (jpointers == nullptr) { - // exception thrown: OutOfMemoryError - *has_exception = JNI_TRUE; - return nullptr; - } + key += jkey_off; + value += jval_off; - env->SetLongArrayRegion(jpointers, 0, len, results.get()); - if (env->ExceptionCheck()) { - // exception thrown: ArrayIndexOutOfBoundsException - *has_exception = JNI_TRUE; - env->DeleteLocalRef(jpointers); - return nullptr; - } + ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); + ROCKSDB_NAMESPACE::Slice value_slice(value, jval_len); - *has_exception = JNI_FALSE; - - return jpointers; - } - - /* - * Helper for operations on a key and value - * for example WriteBatch->Put - * - * TODO(AR) could be extended to cover returning ROCKSDB_NAMESPACE::Status - * from `op` and used for RocksDB->Put etc. - */ - static void kv_op_direct(std::function - op, - JNIEnv* env, jobject jkey, jint jkey_off, - jint jkey_len, jobject jval, jint jval_off, - jint jval_len) { - char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); - if (key == nullptr || - env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Invalid key argument"); - return; - } + op(key_slice, value_slice); + } - char* value = reinterpret_cast(env->GetDirectBufferAddress(jval)); - if (value == nullptr || - env->GetDirectBufferCapacity(jval) < (jval_off + jval_len)) { - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Invalid value argument"); - return; - } + /* + * Helper for operations on a key and value + * for example WriteBatch->Delete + * + * TODO(AR) could be extended to cover returning ROCKSDB_NAMESPACE::Status + * from `op` and used for RocksDB->Delete etc. + */ + static void k_op_direct(std::function op, + JNIEnv* env, jobject jkey, jint jkey_off, + jint jkey_len) { + char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); + if (key == nullptr || + env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, + "Invalid key argument"); + return; + } - key += jkey_off; - value += jval_off; - - ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); - ROCKSDB_NAMESPACE::Slice value_slice(value, jval_len); - - op(key_slice, value_slice); - } - - /* - * Helper for operations on a key and value - * for example WriteBatch->Delete - * - * TODO(AR) could be extended to cover returning ROCKSDB_NAMESPACE::Status - * from `op` and used for RocksDB->Delete etc. - */ - static void k_op_direct(std::function op, - JNIEnv* env, jobject jkey, jint jkey_off, - jint jkey_len) { - char* key = reinterpret_cast(env->GetDirectBufferAddress(jkey)); - if (key == nullptr || - env->GetDirectBufferCapacity(jkey) < (jkey_off + jkey_len)) { - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Invalid key argument"); - return; - } + key += jkey_off; - key += jkey_off; + ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); - ROCKSDB_NAMESPACE::Slice key_slice(key, jkey_len); + return op(key_slice); + } - return op(key_slice); + template + static jint copyToDirect(JNIEnv* env, T& source, jobject jtarget, + jint jtarget_off, jint jtarget_len) { + char* target = + reinterpret_cast(env->GetDirectBufferAddress(jtarget)); + if (target == nullptr || + env->GetDirectBufferCapacity(jtarget) < (jtarget_off + jtarget_len)) { + ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( + env, "Invalid target argument"); + return 0; } - template - static jint copyToDirect(JNIEnv* env, T& source, jobject jtarget, - jint jtarget_off, jint jtarget_len) { - char* target = - reinterpret_cast(env->GetDirectBufferAddress(jtarget)); - if (target == nullptr || - env->GetDirectBufferCapacity(jtarget) < (jtarget_off + jtarget_len)) { - ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( - env, "Invalid target argument"); - return 0; - } - - target += jtarget_off; + target += jtarget_off; - const jint cvalue_len = static_cast(source.size()); - const jint length = std::min(jtarget_len, cvalue_len); + const jint cvalue_len = static_cast(source.size()); + const jint length = std::min(jtarget_len, cvalue_len); - memcpy(target, source.data(), length); + memcpy(target, source.data(), length); - return cvalue_len; - } + return cvalue_len; + } }; class MapJni : public JavaClass { @@ -2411,13 +2454,14 @@ class MapJni : public JavaClass { */ static jmethodID getMapPutMethodId(JNIEnv* env) { jclass jlist_clazz = getJClass(env); - if(jlist_clazz == nullptr) { + if (jlist_clazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = - env->GetMethodID(jlist_clazz, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + static jmethodID mid = env->GetMethodID( + jlist_clazz, "put", + "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); assert(mid != nullptr); return mid; } @@ -2459,7 +2503,8 @@ class HashMapJni : public JavaClass { return nullptr; } - jobject jhash_map = env->NewObject(jclazz, mid, static_cast(initial_capacity)); + jobject jhash_map = + env->NewObject(jclazz, mid, static_cast(initial_capacity)); if (env->ExceptionCheck()) { return nullptr; } @@ -2474,15 +2519,21 @@ class HashMapJni : public JavaClass { * if an error occurs during the mapping */ template - using FnMapKV = std::function> (const std::pair&)>; + using FnMapKV = + std::function>(const std::pair&)>; - // template ::value_type, std::pair>::value, int32_t>::type = 0> - // static void putAll(JNIEnv* env, const jobject jhash_map, I iterator, const FnMapKV &fn_map_kv) { + // template ::value_type, std::pair>::value, + // int32_t>::type = 0> static void putAll(JNIEnv* env, const jobject + // jhash_map, I iterator, const FnMapKV &fn_map_kv) { /** * Returns true if it succeeds, false if an error occurs */ - template - static bool putAll(JNIEnv* env, const jobject jhash_map, iterator_type iterator, iterator_type end, const FnMapKV &fn_map_kv) { + template + static bool putAll(JNIEnv* env, const jobject jhash_map, + iterator_type iterator, iterator_type end, + const FnMapKV& fn_map_kv) { const jmethodID jmid_put = ROCKSDB_NAMESPACE::MapJni::getMapPutMethodId(env); if (jmid_put == nullptr) { @@ -2490,10 +2541,11 @@ class HashMapJni : public JavaClass { } for (auto it = iterator; it != end; ++it) { - const std::unique_ptr> result = fn_map_kv(*it); + const std::unique_ptr> result = + fn_map_kv(*it); if (result == nullptr) { - // an error occurred during fn_map_kv - return false; + // an error occurred during fn_map_kv + return false; } env->CallObjectMethod(jhash_map, jmid_put, result->first, result->second); if (env->ExceptionCheck()) { @@ -2512,14 +2564,17 @@ class HashMapJni : public JavaClass { } /** - * Creates a java.util.Map from a std::map + * Creates a java.util.Map from a std::map * * @param env A pointer to the Java environment * @param map the Cpp map * - * @return a reference to the Java java.util.Map object, or nullptr if an exception occcurred + * @return a reference to the Java java.util.Map object, or nullptr if an + * exception occcurred */ - static jobject fromCppMap(JNIEnv* env, const std::map* map) { + static jobject fromCppMap(JNIEnv* env, + const std::map* map) { if (map == nullptr) { return nullptr; } @@ -2564,14 +2619,17 @@ class HashMapJni : public JavaClass { } /** - * Creates a java.util.Map from a std::map + * Creates a java.util.Map from a std::map * * @param env A pointer to the Java environment * @param map the Cpp map * - * @return a reference to the Java java.util.Map object, or nullptr if an exception occcurred + * @return a reference to the Java java.util.Map object, or nullptr if an + * exception occcurred */ - static jobject fromCppMap(JNIEnv* env, const std::map* map) { + static jobject fromCppMap(JNIEnv* env, + const std::map* map) { if (map == nullptr) { return nullptr; } @@ -2619,14 +2677,17 @@ class HashMapJni : public JavaClass { } /** - * Creates a java.util.Map from a std::map + * Creates a java.util.Map from a std::map * * @param env A pointer to the Java environment * @param map the Cpp map * - * @return a reference to the Java java.util.Map object, or nullptr if an exception occcurred + * @return a reference to the Java java.util.Map object, or nullptr if an + * exception occcurred */ - static jobject fromCppMap(JNIEnv* env, const std::map* map) { + static jobject fromCppMap(JNIEnv* env, + const std::map* map) { if (map == nullptr) { return nullptr; } @@ -2669,15 +2730,17 @@ class HashMapJni : public JavaClass { return jhash_map; } - /** + /** * Creates a java.util.Map from a std::map * * @param env A pointer to the Java environment * @param map the Cpp map * - * @return a reference to the Java java.util.Map object, or nullptr if an exception occcurred + * @return a reference to the Java java.util.Map object, or nullptr if an + * exception occcurred */ - static jobject fromCppMap(JNIEnv* env, const std::map* map) { + static jobject fromCppMap(JNIEnv* env, + const std::map* map) { if (map == nullptr) { return nullptr; } @@ -2807,7 +2870,7 @@ class ColumnFamilyOptionsJni static jobject construct(JNIEnv* env, const ColumnFamilyOptions* cfoptions) { auto* cfo = new ROCKSDB_NAMESPACE::ColumnFamilyOptions(*cfoptions); jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -2893,7 +2956,7 @@ class WriteBatchJni */ static jobject construct(JNIEnv* env, const WriteBatch* wb) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -2929,8 +2992,7 @@ class WriteBatchHandlerJni * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return RocksDBNativeClass::getJClass(env, - "org/rocksdb/WriteBatch$Handler"); + return RocksDBNativeClass::getJClass(env, "org/rocksdb/WriteBatch$Handler"); } /** @@ -2943,7 +3005,7 @@ class WriteBatchHandlerJni */ static jmethodID getPutCfMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -2963,7 +3025,7 @@ class WriteBatchHandlerJni */ static jmethodID getPutMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -2983,7 +3045,7 @@ class WriteBatchHandlerJni */ static jmethodID getMergeCfMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3003,7 +3065,7 @@ class WriteBatchHandlerJni */ static jmethodID getMergeMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3023,7 +3085,7 @@ class WriteBatchHandlerJni */ static jmethodID getDeleteCfMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3043,7 +3105,7 @@ class WriteBatchHandlerJni */ static jmethodID getDeleteMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3063,7 +3125,7 @@ class WriteBatchHandlerJni */ static jmethodID getSingleDeleteCfMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3083,7 +3145,7 @@ class WriteBatchHandlerJni */ static jmethodID getSingleDeleteMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3143,7 +3205,7 @@ class WriteBatchHandlerJni */ static jmethodID getLogDataMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3163,7 +3225,7 @@ class WriteBatchHandlerJni */ static jmethodID getPutBlobIndexCfMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3183,7 +3245,7 @@ class WriteBatchHandlerJni */ static jmethodID getMarkBeginPrepareMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3203,7 +3265,7 @@ class WriteBatchHandlerJni */ static jmethodID getMarkEndPrepareMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3223,7 +3285,7 @@ class WriteBatchHandlerJni */ static jmethodID getMarkNoopMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3243,7 +3305,7 @@ class WriteBatchHandlerJni */ static jmethodID getMarkRollbackMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3263,7 +3325,7 @@ class WriteBatchHandlerJni */ static jmethodID getMarkCommitMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3304,7 +3366,7 @@ class WriteBatchHandlerJni */ static jmethodID getContinueMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3340,7 +3402,7 @@ class WriteBatchSavePointJni : public JavaClass { */ static jmethodID getConstructorMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3360,9 +3422,9 @@ class WriteBatchSavePointJni : public JavaClass { * @return A reference to a Java org.rocksdb.WriteBatch.SavePoint object, or * nullptr if an an exception occurs */ - static jobject construct(JNIEnv* env, const SavePoint &save_point) { + static jobject construct(JNIEnv* env, const SavePoint& save_point) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3373,10 +3435,10 @@ class WriteBatchSavePointJni : public JavaClass { return nullptr; } - jobject jsave_point = env->NewObject(jclazz, mid, - static_cast(save_point.size), - static_cast(save_point.count), - static_cast(save_point.content_flags)); + jobject jsave_point = + env->NewObject(jclazz, mid, static_cast(save_point.size), + static_cast(save_point.count), + static_cast(save_point.content_flags)); if (env->ExceptionCheck()) { return nullptr; } @@ -3401,7 +3463,7 @@ class WriteBatchWithIndexJni */ static jclass getJClass(JNIEnv* env) { return RocksDBNativeClass::getJClass(env, - "org/rocksdb/WriteBatchWithIndex"); + "org/rocksdb/WriteBatchWithIndex"); } }; @@ -3431,7 +3493,7 @@ class HistogramDataJni : public JavaClass { */ static jmethodID getConstructorMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3546,8 +3608,7 @@ class ColumnFamilyHandleJni * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return RocksDBNativeClass::getJClass(env, - "org/rocksdb/ColumnFamilyHandle"); + return RocksDBNativeClass::getJClass(env, "org/rocksdb/ColumnFamilyHandle"); } }; @@ -3606,8 +3667,8 @@ class AbstractCompactionFilterFactoryJni * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return RocksDBNativeClass::getJClass(env, - "org/rocksdb/AbstractCompactionFilterFactory"); + return RocksDBNativeClass::getJClass( + env, "org/rocksdb/AbstractCompactionFilterFactory"); } /** @@ -3620,13 +3681,13 @@ class AbstractCompactionFilterFactoryJni */ static jmethodID getNameMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "name", "()Ljava/lang/String;"); + static jmethodID mid = + env->GetMethodID(jclazz, "name", "()Ljava/lang/String;"); assert(mid != nullptr); return mid; } @@ -3641,14 +3702,13 @@ class AbstractCompactionFilterFactoryJni */ static jmethodID getCreateCompactionFilterMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID(jclazz, - "createCompactionFilter", - "(ZZ)J"); + static jmethodID mid = + env->GetMethodID(jclazz, "createCompactionFilter", "(ZZ)J"); assert(mid != nullptr); return mid; } @@ -3661,15 +3721,15 @@ class AbstractTransactionNotifierJni AbstractTransactionNotifierJni> { public: static jclass getJClass(JNIEnv* env) { - return RocksDBNativeClass::getJClass(env, - "org/rocksdb/AbstractTransactionNotifier"); + return RocksDBNativeClass::getJClass( + env, "org/rocksdb/AbstractTransactionNotifier"); } // Get the java method `snapshotCreated` // of org.rocksdb.AbstractTransactionNotifier. static jmethodID getSnapshotCreatedMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3693,8 +3753,7 @@ class AbstractComparatorJniBridge : public JavaClass { * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/AbstractComparatorJniBridge"); + return JavaClass::getJClass(env, "org/rocksdb/AbstractComparatorJniBridge"); } /** @@ -3709,7 +3768,8 @@ class AbstractComparatorJniBridge : public JavaClass { static jmethodID getCompareInternalMethodId(JNIEnv* env, jclass jclazz) { static jmethodID mid = env->GetStaticMethodID(jclazz, "compareInternal", - "(Lorg/rocksdb/AbstractComparator;Ljava/nio/ByteBuffer;ILjava/nio/ByteBuffer;I)I"); + "(Lorg/rocksdb/AbstractComparator;Ljava/nio/" + "ByteBuffer;ILjava/nio/ByteBuffer;I)I"); assert(mid != nullptr); return mid; } @@ -3723,10 +3783,12 @@ class AbstractComparatorJniBridge : public JavaClass { * @return The Java Method ID or nullptr if the class or method id could not * be retrieved */ - static jmethodID getFindShortestSeparatorInternalMethodId(JNIEnv* env, jclass jclazz) { + static jmethodID getFindShortestSeparatorInternalMethodId(JNIEnv* env, + jclass jclazz) { static jmethodID mid = env->GetStaticMethodID(jclazz, "findShortestSeparatorInternal", - "(Lorg/rocksdb/AbstractComparator;Ljava/nio/ByteBuffer;ILjava/nio/ByteBuffer;I)I"); + "(Lorg/rocksdb/AbstractComparator;Ljava/nio/" + "ByteBuffer;ILjava/nio/ByteBuffer;I)I"); assert(mid != nullptr); return mid; } @@ -3740,10 +3802,11 @@ class AbstractComparatorJniBridge : public JavaClass { * @return The Java Method ID or nullptr if the class or method id could not * be retrieved */ - static jmethodID getFindShortSuccessorInternalMethodId(JNIEnv* env, jclass jclazz) { - static jmethodID mid = - env->GetStaticMethodID(jclazz, "findShortSuccessorInternal", - "(Lorg/rocksdb/AbstractComparator;Ljava/nio/ByteBuffer;I)I"); + static jmethodID getFindShortSuccessorInternalMethodId(JNIEnv* env, + jclass jclazz) { + static jmethodID mid = env->GetStaticMethodID( + jclazz, "findShortSuccessorInternal", + "(Lorg/rocksdb/AbstractComparator;Ljava/nio/ByteBuffer;I)I"); assert(mid != nullptr); return mid; } @@ -3764,8 +3827,7 @@ class AbstractComparatorJni * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return RocksDBNativeClass::getJClass(env, - "org/rocksdb/AbstractComparator"); + return RocksDBNativeClass::getJClass(env, "org/rocksdb/AbstractComparator"); } /** @@ -3778,7 +3840,7 @@ class AbstractComparatorJni */ static jmethodID getNameMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -3837,19 +3899,19 @@ class SliceJni */ static jobject construct0(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } static jmethodID mid = env->GetMethodID(jclazz, "", "()V"); - if(mid == nullptr) { + if (mid == nullptr) { // exception occurred accessing method return nullptr; } jobject jslice = env->NewObject(jclazz, mid); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { return nullptr; } @@ -3885,19 +3947,19 @@ class DirectSliceJni */ static jobject construct0(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } static jmethodID mid = env->GetMethodID(jclazz, "", "()V"); - if(mid == nullptr) { + if (mid == nullptr) { // exception occurred accessing method return nullptr; } jobject jdirect_slice = env->NewObject(jclazz, mid); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { return nullptr; } @@ -3938,14 +4000,14 @@ class BackupInfoJni : public JavaClass { uint64_t size, uint32_t number_files, const std::string& app_metadata) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } static jmethodID mid = env->GetMethodID(jclazz, "", "(IJJILjava/lang/String;)V"); - if(mid == nullptr) { + if (mid == nullptr) { // exception occurred accessing method return nullptr; } @@ -3961,7 +4023,7 @@ class BackupInfoJni : public JavaClass { jobject jbackup_info = env->NewObject(jclazz, mid, backup_id, timestamp, size, number_files, japp_metadata); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { env->DeleteLocalRef(japp_metadata); return nullptr; } @@ -3983,23 +4045,23 @@ class BackupInfoListJni { * if an exception occurs */ static jobject getBackupInfo(JNIEnv* env, - std::vector backup_infos) { + std::vector backup_infos) { jclass jarray_list_clazz = ROCKSDB_NAMESPACE::ListJni::getArrayListClass(env); - if(jarray_list_clazz == nullptr) { + if (jarray_list_clazz == nullptr) { // exception occurred accessing class return nullptr; } jmethodID cstr_mid = ROCKSDB_NAMESPACE::ListJni::getArrayListConstructorMethodId(env); - if(cstr_mid == nullptr) { + if (cstr_mid == nullptr) { // exception occurred accessing method return nullptr; } jmethodID add_mid = ROCKSDB_NAMESPACE::ListJni::getListAddMethodId(env); - if(add_mid == nullptr) { + if (add_mid == nullptr) { // exception occurred accessing method return nullptr; } @@ -4007,7 +4069,7 @@ class BackupInfoListJni { // create java list jobject jbackup_info_handle_list = env->NewObject(jarray_list_clazz, cstr_mid, backup_infos.size()); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception occurred constructing object return nullptr; } @@ -4020,12 +4082,12 @@ class BackupInfoListJni { jobject obj = ROCKSDB_NAMESPACE::BackupInfoJni::construct0( env, backup_info.backup_id, backup_info.timestamp, backup_info.size, backup_info.number_files, backup_info.app_metadata); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception occurred constructing object - if(obj != nullptr) { + if (obj != nullptr) { env->DeleteLocalRef(obj); } - if(jbackup_info_handle_list != nullptr) { + if (jbackup_info_handle_list != nullptr) { env->DeleteLocalRef(jbackup_info_handle_list); } return nullptr; @@ -4033,12 +4095,12 @@ class BackupInfoListJni { jboolean rs = env->CallBooleanMethod(jbackup_info_handle_list, add_mid, obj); - if(env->ExceptionCheck() || rs == JNI_FALSE) { + if (env->ExceptionCheck() || rs == JNI_FALSE) { // exception occurred calling method, or could not add - if(obj != nullptr) { + if (obj != nullptr) { env->DeleteLocalRef(obj); } - if(jbackup_info_handle_list != nullptr) { + if (jbackup_info_handle_list != nullptr) { env->DeleteLocalRef(jbackup_info_handle_list); } return nullptr; @@ -4075,14 +4137,13 @@ class WBWIRocksIteratorJni : public JavaClass { */ static jfieldID getWriteEntryField(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jfieldID fid = - env->GetFieldID(jclazz, "entry", - "Lorg/rocksdb/WBWIRocksIterator$WriteEntry;"); + static jfieldID fid = env->GetFieldID( + jclazz, "entry", "Lorg/rocksdb/WBWIRocksIterator$WriteEntry;"); assert(fid != nullptr); return fid; } @@ -4100,7 +4161,7 @@ class WBWIRocksIteratorJni : public JavaClass { assert(jwbwi_rocks_iterator != nullptr); jfieldID jwrite_entry_field = getWriteEntryField(env); - if(jwrite_entry_field == nullptr) { + if (jwrite_entry_field == nullptr) { // exception occurred accessing the field return nullptr; } @@ -4122,9 +4183,7 @@ class WriteTypeJni : public JavaClass { * @return A reference to the enum field value or a nullptr if * the enum field value could not be retrieved */ - static jobject PUT(JNIEnv* env) { - return getEnum(env, "PUT"); - } + static jobject PUT(JNIEnv* env) { return getEnum(env, "PUT"); } /** * Get the MERGE enum field value of WBWIRocksIterator.WriteType @@ -4134,9 +4193,7 @@ class WriteTypeJni : public JavaClass { * @return A reference to the enum field value or a nullptr if * the enum field value could not be retrieved */ - static jobject MERGE(JNIEnv* env) { - return getEnum(env, "MERGE"); - } + static jobject MERGE(JNIEnv* env) { return getEnum(env, "MERGE"); } /** * Get the DELETE enum field value of WBWIRocksIterator.WriteType @@ -4146,9 +4203,7 @@ class WriteTypeJni : public JavaClass { * @return A reference to the enum field value or a nullptr if * the enum field value could not be retrieved */ - static jobject DELETE(JNIEnv* env) { - return getEnum(env, "DELETE"); - } + static jobject DELETE(JNIEnv* env) { return getEnum(env, "DELETE"); } /** * Get the LOG enum field value of WBWIRocksIterator.WriteType @@ -4158,9 +4213,7 @@ class WriteTypeJni : public JavaClass { * @return A reference to the enum field value or a nullptr if * the enum field value could not be retrieved */ - static jobject LOG(JNIEnv* env) { - return getEnum(env, "LOG"); - } + static jobject LOG(JNIEnv* env) { return getEnum(env, "LOG"); } // Returns the equivalent org.rocksdb.WBWIRocksIterator.WriteType for the // provided C++ ROCKSDB_NAMESPACE::WriteType enum @@ -4210,18 +4263,17 @@ class WriteTypeJni : public JavaClass { */ static jobject getEnum(JNIEnv* env, const char name[]) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - jfieldID jfid = - env->GetStaticFieldID(jclazz, name, - "Lorg/rocksdb/WBWIRocksIterator$WriteType;"); - if(env->ExceptionCheck()) { + jfieldID jfid = env->GetStaticFieldID( + jclazz, name, "Lorg/rocksdb/WBWIRocksIterator$WriteType;"); + if (env->ExceptionCheck()) { // exception occurred while getting field return nullptr; - } else if(jfid == nullptr) { + } else if (jfid == nullptr) { return nullptr; } @@ -4243,85 +4295,82 @@ class WriteEntryJni : public JavaClass { * ClassFormatError, ClassCircularityError, NoClassDefFoundError, * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ - static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, "org/rocksdb/WBWIRocksIterator$WriteEntry"); - } + static jclass getJClass(JNIEnv* env) { + return JavaClass::getJClass(env, + "org/rocksdb/WBWIRocksIterator$WriteEntry"); + } }; // The portal class for org.rocksdb.InfoLogLevel class InfoLogLevelJni : public JavaClass { public: - /** - * Get the DEBUG_LEVEL enum field value of InfoLogLevel - * - * @param env A pointer to the Java environment - * - * @return A reference to the enum field value or a nullptr if - * the enum field value could not be retrieved - */ - static jobject DEBUG_LEVEL(JNIEnv* env) { - return getEnum(env, "DEBUG_LEVEL"); - } - - /** - * Get the INFO_LEVEL enum field value of InfoLogLevel - * - * @param env A pointer to the Java environment - * - * @return A reference to the enum field value or a nullptr if - * the enum field value could not be retrieved - */ - static jobject INFO_LEVEL(JNIEnv* env) { - return getEnum(env, "INFO_LEVEL"); - } - - /** - * Get the WARN_LEVEL enum field value of InfoLogLevel - * - * @param env A pointer to the Java environment - * - * @return A reference to the enum field value or a nullptr if - * the enum field value could not be retrieved - */ - static jobject WARN_LEVEL(JNIEnv* env) { - return getEnum(env, "WARN_LEVEL"); - } - - /** - * Get the ERROR_LEVEL enum field value of InfoLogLevel - * - * @param env A pointer to the Java environment - * - * @return A reference to the enum field value or a nullptr if - * the enum field value could not be retrieved - */ - static jobject ERROR_LEVEL(JNIEnv* env) { - return getEnum(env, "ERROR_LEVEL"); - } - - /** - * Get the FATAL_LEVEL enum field value of InfoLogLevel - * - * @param env A pointer to the Java environment - * - * @return A reference to the enum field value or a nullptr if - * the enum field value could not be retrieved - */ - static jobject FATAL_LEVEL(JNIEnv* env) { - return getEnum(env, "FATAL_LEVEL"); - } - - /** - * Get the HEADER_LEVEL enum field value of InfoLogLevel - * - * @param env A pointer to the Java environment - * - * @return A reference to the enum field value or a nullptr if - * the enum field value could not be retrieved - */ - static jobject HEADER_LEVEL(JNIEnv* env) { - return getEnum(env, "HEADER_LEVEL"); - } + /** + * Get the DEBUG_LEVEL enum field value of InfoLogLevel + * + * @param env A pointer to the Java environment + * + * @return A reference to the enum field value or a nullptr if + * the enum field value could not be retrieved + */ + static jobject DEBUG_LEVEL(JNIEnv* env) { + return getEnum(env, "DEBUG_LEVEL"); + } + + /** + * Get the INFO_LEVEL enum field value of InfoLogLevel + * + * @param env A pointer to the Java environment + * + * @return A reference to the enum field value or a nullptr if + * the enum field value could not be retrieved + */ + static jobject INFO_LEVEL(JNIEnv* env) { return getEnum(env, "INFO_LEVEL"); } + + /** + * Get the WARN_LEVEL enum field value of InfoLogLevel + * + * @param env A pointer to the Java environment + * + * @return A reference to the enum field value or a nullptr if + * the enum field value could not be retrieved + */ + static jobject WARN_LEVEL(JNIEnv* env) { return getEnum(env, "WARN_LEVEL"); } + + /** + * Get the ERROR_LEVEL enum field value of InfoLogLevel + * + * @param env A pointer to the Java environment + * + * @return A reference to the enum field value or a nullptr if + * the enum field value could not be retrieved + */ + static jobject ERROR_LEVEL(JNIEnv* env) { + return getEnum(env, "ERROR_LEVEL"); + } + + /** + * Get the FATAL_LEVEL enum field value of InfoLogLevel + * + * @param env A pointer to the Java environment + * + * @return A reference to the enum field value or a nullptr if + * the enum field value could not be retrieved + */ + static jobject FATAL_LEVEL(JNIEnv* env) { + return getEnum(env, "FATAL_LEVEL"); + } + + /** + * Get the HEADER_LEVEL enum field value of InfoLogLevel + * + * @param env A pointer to the Java environment + * + * @return A reference to the enum field value or a nullptr if + * the enum field value could not be retrieved + */ + static jobject HEADER_LEVEL(JNIEnv* env) { + return getEnum(env, "HEADER_LEVEL"); + } private: /** @@ -4348,17 +4397,17 @@ class InfoLogLevelJni : public JavaClass { */ static jobject getEnum(JNIEnv* env, const char name[]) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } jfieldID jfid = env->GetStaticFieldID(jclazz, name, "Lorg/rocksdb/InfoLogLevel;"); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception occurred while getting field return nullptr; - } else if(jfid == nullptr) { + } else if (jfid == nullptr) { return nullptr; } @@ -4396,14 +4445,13 @@ class LoggerJni */ static jmethodID getLogMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = - env->GetMethodID(jclazz, "log", - "(Lorg/rocksdb/InfoLogLevel;Ljava/lang/String;)V"); + static jmethodID mid = env->GetMethodID( + jclazz, "log", "(Lorg/rocksdb/InfoLogLevel;Ljava/lang/String;)V"); assert(mid != nullptr); return mid; } @@ -4411,7 +4459,7 @@ class LoggerJni // The portal class for org.rocksdb.TransactionLogIterator.BatchResult class BatchResultJni : public JavaClass { - public: + public: /** * Get the Java Class org.rocksdb.TransactionLogIterator.BatchResult * @@ -4422,8 +4470,8 @@ class BatchResultJni : public JavaClass { * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/TransactionLogIterator$BatchResult"); + return JavaClass::getJClass( + env, "org/rocksdb/TransactionLogIterator$BatchResult"); } /** @@ -4441,21 +4489,20 @@ class BatchResultJni : public JavaClass { static jobject construct(JNIEnv* env, ROCKSDB_NAMESPACE::BatchResult& batch_result) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - jmethodID mid = env->GetMethodID( - jclazz, "", "(JJ)V"); - if(mid == nullptr) { + jmethodID mid = env->GetMethodID(jclazz, "", "(JJ)V"); + if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; } - jobject jbatch_result = env->NewObject(jclazz, mid, - batch_result.sequence, batch_result.writeBatchPtr.get()); - if(jbatch_result == nullptr) { + jobject jbatch_result = env->NewObject(jclazz, mid, batch_result.sequence, + batch_result.writeBatchPtr.get()); + if (jbatch_result == nullptr) { // exception thrown: InstantiationException or OutOfMemoryError return nullptr; } @@ -4473,7 +4520,7 @@ class BottommostLevelCompactionJni { static jint toJavaBottommostLevelCompaction( const ROCKSDB_NAMESPACE::BottommostLevelCompaction& bottommost_level_compaction) { - switch(bottommost_level_compaction) { + switch (bottommost_level_compaction) { case ROCKSDB_NAMESPACE::BottommostLevelCompaction::kSkip: return 0x0; case ROCKSDB_NAMESPACE::BottommostLevelCompaction:: @@ -4492,7 +4539,7 @@ class BottommostLevelCompactionJni { // enum for the provided Java org.rocksdb.BottommostLevelCompaction static ROCKSDB_NAMESPACE::BottommostLevelCompaction toCppBottommostLevelCompaction(jint bottommost_level_compaction) { - switch(bottommost_level_compaction) { + switch (bottommost_level_compaction) { case 0x0: return ROCKSDB_NAMESPACE::BottommostLevelCompaction::kSkip; case 0x1: @@ -4517,7 +4564,7 @@ class CompactionStopStyleJni { // C++ ROCKSDB_NAMESPACE::CompactionStopStyle enum static jbyte toJavaCompactionStopStyle( const ROCKSDB_NAMESPACE::CompactionStopStyle& compaction_stop_style) { - switch(compaction_stop_style) { + switch (compaction_stop_style) { case ROCKSDB_NAMESPACE::CompactionStopStyle:: kCompactionStopStyleSimilarSize: return 0x0; @@ -4533,7 +4580,7 @@ class CompactionStopStyleJni { // the provided Java org.rocksdb.CompactionStopStyle static ROCKSDB_NAMESPACE::CompactionStopStyle toCppCompactionStopStyle( jbyte jcompaction_stop_style) { - switch(jcompaction_stop_style) { + switch (jcompaction_stop_style) { case 0x0: return ROCKSDB_NAMESPACE::CompactionStopStyle:: kCompactionStopStyleSimilarSize; @@ -4555,7 +4602,7 @@ class CompressionTypeJni { // C++ ROCKSDB_NAMESPACE::CompressionType enum static jbyte toJavaCompressionType( const ROCKSDB_NAMESPACE::CompressionType& compression_type) { - switch(compression_type) { + switch (compression_type) { case ROCKSDB_NAMESPACE::CompressionType::kNoCompression: return 0x0; case ROCKSDB_NAMESPACE::CompressionType::kSnappyCompression: @@ -4582,7 +4629,7 @@ class CompressionTypeJni { // provided Java org.rocksdb.CompressionType static ROCKSDB_NAMESPACE::CompressionType toCppCompressionType( jbyte jcompression_type) { - switch(jcompression_type) { + switch (jcompression_type) { case 0x0: return ROCKSDB_NAMESPACE::CompressionType::kNoCompression; case 0x1: @@ -4613,7 +4660,7 @@ class CompactionPriorityJni { // C++ ROCKSDB_NAMESPACE::CompactionPri enum static jbyte toJavaCompactionPriority( const ROCKSDB_NAMESPACE::CompactionPri& compaction_priority) { - switch(compaction_priority) { + switch (compaction_priority) { case ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize: return 0x0; case ROCKSDB_NAMESPACE::CompactionPri::kOldestLargestSeqFirst: @@ -4633,7 +4680,7 @@ class CompactionPriorityJni { // provided Java org.rocksdb.CompactionPriority static ROCKSDB_NAMESPACE::CompactionPri toCppCompactionPriority( jbyte jcompaction_priority) { - switch(jcompaction_priority) { + switch (jcompaction_priority) { case 0x0: return ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize; case 0x1: @@ -4658,7 +4705,7 @@ class AccessHintJni { // C++ ROCKSDB_NAMESPACE::DBOptions::AccessHint enum static jbyte toJavaAccessHint( const ROCKSDB_NAMESPACE::DBOptions::AccessHint& access_hint) { - switch(access_hint) { + switch (access_hint) { case ROCKSDB_NAMESPACE::DBOptions::AccessHint::NONE: return 0x0; case ROCKSDB_NAMESPACE::DBOptions::AccessHint::NORMAL: @@ -4677,7 +4724,7 @@ class AccessHintJni { // for the provided Java org.rocksdb.AccessHint static ROCKSDB_NAMESPACE::DBOptions::AccessHint toCppAccessHint( jbyte jaccess_hint) { - switch(jaccess_hint) { + switch (jaccess_hint) { case 0x0: return ROCKSDB_NAMESPACE::DBOptions::AccessHint::NONE; case 0x1: @@ -4700,7 +4747,7 @@ class WALRecoveryModeJni { // C++ ROCKSDB_NAMESPACE::WALRecoveryMode enum static jbyte toJavaWALRecoveryMode( const ROCKSDB_NAMESPACE::WALRecoveryMode& wal_recovery_mode) { - switch(wal_recovery_mode) { + switch (wal_recovery_mode) { case ROCKSDB_NAMESPACE::WALRecoveryMode::kTolerateCorruptedTailRecords: return 0x0; case ROCKSDB_NAMESPACE::WALRecoveryMode::kAbsoluteConsistency: @@ -4719,7 +4766,7 @@ class WALRecoveryModeJni { // provided Java org.rocksdb.WALRecoveryMode static ROCKSDB_NAMESPACE::WALRecoveryMode toCppWALRecoveryMode( jbyte jwal_recovery_mode) { - switch(jwal_recovery_mode) { + switch (jwal_recovery_mode) { case 0x0: return ROCKSDB_NAMESPACE::WALRecoveryMode:: kTolerateCorruptedTailRecords; @@ -4742,7 +4789,7 @@ class TickerTypeJni { // Returns the equivalent org.rocksdb.TickerType for the provided // C++ ROCKSDB_NAMESPACE::Tickers enum static jbyte toJavaTickerType(const ROCKSDB_NAMESPACE::Tickers& tickers) { - switch(tickers) { + switch (tickers) { case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_MISS: return 0x0; case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_HIT: @@ -5123,7 +5170,7 @@ class TickerTypeJni { // Returns the equivalent C++ ROCKSDB_NAMESPACE::Tickers enum for the // provided Java org.rocksdb.TickerType static ROCKSDB_NAMESPACE::Tickers toCppTickers(jbyte jticker_type) { - switch(jticker_type) { + switch (jticker_type) { case 0x0: return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_MISS; case 0x1: @@ -5512,7 +5559,7 @@ class HistogramTypeJni { // C++ ROCKSDB_NAMESPACE::Histograms enum static jbyte toJavaHistogramsType( const ROCKSDB_NAMESPACE::Histograms& histograms) { - switch(histograms) { + switch (histograms) { case ROCKSDB_NAMESPACE::Histograms::DB_GET: return 0x0; case ROCKSDB_NAMESPACE::Histograms::DB_WRITE: @@ -5575,7 +5622,8 @@ class HistogramTypeJni { return 0x1D; case ROCKSDB_NAMESPACE::Histograms::READ_NUM_MERGE_OPERANDS: return 0x1E; - // 0x20 to skip 0x1F so TICKER_ENUM_MAX remains unchanged for minor version compatibility. + // 0x20 to skip 0x1F so TICKER_ENUM_MAX remains unchanged for minor + // version compatibility. case ROCKSDB_NAMESPACE::Histograms::FLUSH_TIME: return 0x20; case ROCKSDB_NAMESPACE::Histograms::BLOB_DB_KEY_SIZE: @@ -5640,7 +5688,7 @@ class HistogramTypeJni { // Returns the equivalent C++ ROCKSDB_NAMESPACE::Histograms enum for the // provided Java org.rocksdb.HistogramsType static ROCKSDB_NAMESPACE::Histograms toCppHistograms(jbyte jhistograms_type) { - switch(jhistograms_type) { + switch (jhistograms_type) { case 0x0: return ROCKSDB_NAMESPACE::Histograms::DB_GET; case 0x1: @@ -5703,7 +5751,8 @@ class HistogramTypeJni { return ROCKSDB_NAMESPACE::Histograms::DECOMPRESSION_TIMES_NANOS; case 0x1E: return ROCKSDB_NAMESPACE::Histograms::READ_NUM_MERGE_OPERANDS; - // 0x20 to skip 0x1F so TICKER_ENUM_MAX remains unchanged for minor version compatibility. + // 0x20 to skip 0x1F so TICKER_ENUM_MAX remains unchanged for minor + // version compatibility. case 0x20: return ROCKSDB_NAMESPACE::Histograms::FLUSH_TIME; case 0x21: @@ -5774,7 +5823,7 @@ class StatsLevelJni { // C++ ROCKSDB_NAMESPACE::StatsLevel enum static jbyte toJavaStatsLevel( const ROCKSDB_NAMESPACE::StatsLevel& stats_level) { - switch(stats_level) { + switch (stats_level) { case ROCKSDB_NAMESPACE::StatsLevel::kExceptDetailedTimers: return 0x0; case ROCKSDB_NAMESPACE::StatsLevel::kExceptTimeForMutex: @@ -5791,7 +5840,7 @@ class StatsLevelJni { // Returns the equivalent C++ ROCKSDB_NAMESPACE::StatsLevel enum for the // provided Java org.rocksdb.StatsLevel static ROCKSDB_NAMESPACE::StatsLevel toCppStatsLevel(jbyte jstats_level) { - switch(jstats_level) { + switch (jstats_level) { case 0x0: return ROCKSDB_NAMESPACE::StatsLevel::kExceptDetailedTimers; case 0x1: @@ -5813,7 +5862,7 @@ class RateLimiterModeJni { // C++ ROCKSDB_NAMESPACE::RateLimiter::Mode enum static jbyte toJavaRateLimiterMode( const ROCKSDB_NAMESPACE::RateLimiter::Mode& rate_limiter_mode) { - switch(rate_limiter_mode) { + switch (rate_limiter_mode) { case ROCKSDB_NAMESPACE::RateLimiter::Mode::kReadsOnly: return 0x0; case ROCKSDB_NAMESPACE::RateLimiter::Mode::kWritesOnly: @@ -5831,7 +5880,7 @@ class RateLimiterModeJni { // the provided Java org.rocksdb.RateLimiterMode static ROCKSDB_NAMESPACE::RateLimiter::Mode toCppRateLimiterMode( jbyte jrate_limiter_mode) { - switch(jrate_limiter_mode) { + switch (jrate_limiter_mode) { case 0x0: return ROCKSDB_NAMESPACE::RateLimiter::Mode::kReadsOnly; case 0x1: @@ -5848,44 +5897,44 @@ class RateLimiterModeJni { // The portal class for org.rocksdb.MemoryUsageType class MemoryUsageTypeJni { -public: - // Returns the equivalent org.rocksdb.MemoryUsageType for the provided - // C++ ROCKSDB_NAMESPACE::MemoryUtil::UsageType enum - static jbyte toJavaMemoryUsageType( - const ROCKSDB_NAMESPACE::MemoryUtil::UsageType& usage_type) { - switch (usage_type) { - case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableTotal: - return 0x0; - case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableUnFlushed: - return 0x1; - case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kTableReadersTotal: - return 0x2; - case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kCacheTotal: - return 0x3; - default: - // undefined: use kNumUsageTypes - return 0x4; - } - } - - // Returns the equivalent C++ ROCKSDB_NAMESPACE::MemoryUtil::UsageType enum for - // the provided Java org.rocksdb.MemoryUsageType - static ROCKSDB_NAMESPACE::MemoryUtil::UsageType toCppMemoryUsageType( - jbyte usage_type) { - switch (usage_type) { - case 0x0: - return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableTotal; - case 0x1: - return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableUnFlushed; - case 0x2: - return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kTableReadersTotal; - case 0x3: - return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kCacheTotal; - default: - // undefined/default: use kNumUsageTypes - return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kNumUsageTypes; - } - } + public: + // Returns the equivalent org.rocksdb.MemoryUsageType for the provided + // C++ ROCKSDB_NAMESPACE::MemoryUtil::UsageType enum + static jbyte toJavaMemoryUsageType( + const ROCKSDB_NAMESPACE::MemoryUtil::UsageType& usage_type) { + switch (usage_type) { + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableTotal: + return 0x0; + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableUnFlushed: + return 0x1; + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kTableReadersTotal: + return 0x2; + case ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kCacheTotal: + return 0x3; + default: + // undefined: use kNumUsageTypes + return 0x4; + } + } + + // Returns the equivalent C++ ROCKSDB_NAMESPACE::MemoryUtil::UsageType enum + // for the provided Java org.rocksdb.MemoryUsageType + static ROCKSDB_NAMESPACE::MemoryUtil::UsageType toCppMemoryUsageType( + jbyte usage_type) { + switch (usage_type) { + case 0x0: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableTotal; + case 0x1: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kMemTableUnFlushed; + case 0x2: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kTableReadersTotal; + case 0x3: + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kCacheTotal; + default: + // undefined/default: use kNumUsageTypes + return ROCKSDB_NAMESPACE::MemoryUtil::UsageType::kNumUsageTypes; + } + } }; // The portal class for org.rocksdb.Transaction @@ -5901,8 +5950,7 @@ class TransactionJni : public JavaClass { * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/Transaction"); + return JavaClass::getJClass(env, "org/rocksdb/Transaction"); } /** @@ -5918,31 +5966,33 @@ class TransactionJni : public JavaClass { * org.rocksdb.Transaction.WaitingTransactions object, * or nullptr if an an exception occurs */ - static jobject newWaitingTransactions(JNIEnv* env, jobject jtransaction, - const uint32_t column_family_id, const std::string &key, - const std::vector &transaction_ids) { + static jobject newWaitingTransactions( + JNIEnv* env, jobject jtransaction, const uint32_t column_family_id, + const std::string& key, + const std::vector& transaction_ids) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } jmethodID mid = env->GetMethodID( - jclazz, "newWaitingTransactions", "(JLjava/lang/String;[J)Lorg/rocksdb/Transaction$WaitingTransactions;"); - if(mid == nullptr) { + jclazz, "newWaitingTransactions", + "(JLjava/lang/String;[J)Lorg/rocksdb/Transaction$WaitingTransactions;"); + if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; } jstring jkey = env->NewStringUTF(key.c_str()); - if(jkey == nullptr) { + if (jkey == nullptr) { // exception thrown: OutOfMemoryError return nullptr; } const size_t len = transaction_ids.size(); jlongArray jtransaction_ids = env->NewLongArray(static_cast(len)); - if(jtransaction_ids == nullptr) { + if (jtransaction_ids == nullptr) { // exception thrown: OutOfMemoryError env->DeleteLocalRef(jkey); return nullptr; @@ -5950,21 +6000,22 @@ class TransactionJni : public JavaClass { jboolean is_copy; jlong* body = env->GetLongArrayElements(jtransaction_ids, &is_copy); - if(body == nullptr) { - // exception thrown: OutOfMemoryError - env->DeleteLocalRef(jkey); - env->DeleteLocalRef(jtransaction_ids); - return nullptr; + if (body == nullptr) { + // exception thrown: OutOfMemoryError + env->DeleteLocalRef(jkey); + env->DeleteLocalRef(jtransaction_ids); + return nullptr; } - for(size_t i = 0; i < len; ++i) { + for (size_t i = 0; i < len; ++i) { body[i] = static_cast(transaction_ids[i]); } env->ReleaseLongArrayElements(jtransaction_ids, body, is_copy == JNI_TRUE ? 0 : JNI_ABORT); - jobject jwaiting_transactions = env->CallObjectMethod(jtransaction, - mid, static_cast(column_family_id), jkey, jtransaction_ids); - if(env->ExceptionCheck()) { + jobject jwaiting_transactions = env->CallObjectMethod( + jtransaction, mid, static_cast(column_family_id), jkey, + jtransaction_ids); + if (env->ExceptionCheck()) { // exception thrown: InstantiationException or OutOfMemoryError env->DeleteLocalRef(jkey); env->DeleteLocalRef(jtransaction_ids); @@ -5978,18 +6029,17 @@ class TransactionJni : public JavaClass { // The portal class for org.rocksdb.TransactionDB class TransactionDBJni : public JavaClass { public: - /** - * Get the Java Class org.rocksdb.TransactionDB - * - * @param env A pointer to the Java environment - * - * @return The Java Class or nullptr if one of the - * ClassFormatError, ClassCircularityError, NoClassDefFoundError, - * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown - */ + /** + * Get the Java Class org.rocksdb.TransactionDB + * + * @param env A pointer to the Java environment + * + * @return The Java Class or nullptr if one of the + * ClassFormatError, ClassCircularityError, NoClassDefFoundError, + * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown + */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/TransactionDB"); + return JavaClass::getJClass(env, "org/rocksdb/TransactionDB"); } /** @@ -6011,29 +6061,30 @@ class TransactionDBJni : public JavaClass { const uint32_t column_family_id, const std::string& waiting_key, const bool exclusive) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } jmethodID mid = env->GetMethodID( - jclazz, "newDeadlockInfo", "(JJLjava/lang/String;Z)Lorg/rocksdb/TransactionDB$DeadlockInfo;"); - if(mid == nullptr) { + jclazz, "newDeadlockInfo", + "(JJLjava/lang/String;Z)Lorg/rocksdb/TransactionDB$DeadlockInfo;"); + if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; } jstring jwaiting_key = env->NewStringUTF(waiting_key.c_str()); - if(jwaiting_key == nullptr) { + if (jwaiting_key == nullptr) { // exception thrown: OutOfMemoryError return nullptr; } // resolve the column family id to a ColumnFamilyHandle - jobject jdeadlock_info = env->CallObjectMethod(jtransaction_db, - mid, transaction_id, static_cast(column_family_id), - jwaiting_key, exclusive); - if(env->ExceptionCheck()) { + jobject jdeadlock_info = env->CallObjectMethod( + jtransaction_db, mid, transaction_id, + static_cast(column_family_id), jwaiting_key, exclusive); + if (env->ExceptionCheck()) { // exception thrown: InstantiationException or OutOfMemoryError env->DeleteLocalRef(jwaiting_key); return nullptr; @@ -6093,8 +6144,7 @@ class KeyLockInfoJni : public JavaClass { * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/TransactionDB$KeyLockInfo"); + return JavaClass::getJClass(env, "org/rocksdb/TransactionDB$KeyLockInfo"); } /** @@ -6112,13 +6162,13 @@ class KeyLockInfoJni : public JavaClass { static jobject construct( JNIEnv* env, const ROCKSDB_NAMESPACE::KeyLockInfo& key_lock_info) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - jmethodID mid = env->GetMethodID( - jclazz, "", "(Ljava/lang/String;[JZ)V"); + jmethodID mid = + env->GetMethodID(jclazz, "", "(Ljava/lang/String;[JZ)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; @@ -6130,7 +6180,8 @@ class KeyLockInfoJni : public JavaClass { return nullptr; } - const jsize jtransaction_ids_len = static_cast(key_lock_info.ids.size()); + const jsize jtransaction_ids_len = + static_cast(key_lock_info.ids.size()); jlongArray jtransactions_ids = env->NewLongArray(jtransaction_ids_len); if (jtransactions_ids == nullptr) { // exception thrown: OutOfMemoryError @@ -6138,9 +6189,9 @@ class KeyLockInfoJni : public JavaClass { return nullptr; } - const jobject jkey_lock_info = env->NewObject(jclazz, mid, - jkey, jtransactions_ids, key_lock_info.exclusive); - if(jkey_lock_info == nullptr) { + const jobject jkey_lock_info = env->NewObject( + jclazz, mid, jkey, jtransactions_ids, key_lock_info.exclusive); + if (jkey_lock_info == nullptr) { // exception thrown: InstantiationException or OutOfMemoryError env->DeleteLocalRef(jtransactions_ids); env->DeleteLocalRef(jkey); @@ -6163,8 +6214,8 @@ class DeadlockInfoJni : public JavaClass { * ClassFormatError, ClassCircularityError, NoClassDefFoundError, * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ - static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env,"org/rocksdb/TransactionDB$DeadlockInfo"); + static jclass getJClass(JNIEnv* env) { + return JavaClass::getJClass(env, "org/rocksdb/TransactionDB$DeadlockInfo"); } }; @@ -6181,8 +6232,7 @@ class DeadlockPathJni : public JavaClass { * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/TransactionDB$DeadlockPath"); + return JavaClass::getJClass(env, "org/rocksdb/TransactionDB$DeadlockPath"); } /** @@ -6194,24 +6244,23 @@ class DeadlockPathJni : public JavaClass { * org.rocksdb.TransactionDB.DeadlockPath object, * or nullptr if an an exception occurs */ - static jobject construct(JNIEnv* env, - const jobjectArray jdeadlock_infos, const bool limit_exceeded) { + static jobject construct(JNIEnv* env, const jobjectArray jdeadlock_infos, + const bool limit_exceeded) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - jmethodID mid = env->GetMethodID( - jclazz, "", "([LDeadlockInfo;Z)V"); + jmethodID mid = env->GetMethodID(jclazz, "", "([LDeadlockInfo;Z)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; } - const jobject jdeadlock_path = env->NewObject(jclazz, mid, - jdeadlock_infos, limit_exceeded); - if(jdeadlock_path == nullptr) { + const jobject jdeadlock_path = + env->NewObject(jclazz, mid, jdeadlock_infos, limit_exceeded); + if (jdeadlock_path == nullptr) { // exception thrown: InstantiationException or OutOfMemoryError return nullptr; } @@ -6235,7 +6284,7 @@ class AbstractTableFilterJni */ static jmethodID getFilterMethod(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } @@ -6949,8 +6998,7 @@ class ThreadStatusJni : public JavaClass { * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return JavaClass::getJClass(env, - "org/rocksdb/ThreadStatus"); + return JavaClass::getJClass(env, "org/rocksdb/ThreadStatus"); } /** @@ -6966,12 +7014,13 @@ class ThreadStatusJni : public JavaClass { static jobject construct( JNIEnv* env, const ROCKSDB_NAMESPACE::ThreadStatus* thread_status) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - jmethodID mid = env->GetMethodID(jclazz, "", "(JBLjava/lang/String;Ljava/lang/String;BJB[JB)V"); + jmethodID mid = env->GetMethodID( + jclazz, "", "(JBLjava/lang/String;Ljava/lang/String;BJB[JB)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; @@ -6980,23 +7029,22 @@ class ThreadStatusJni : public JavaClass { jstring jdb_name = JniUtil::toJavaString(env, &(thread_status->db_name), true); if (env->ExceptionCheck()) { - // an error occurred - return nullptr; + // an error occurred + return nullptr; } jstring jcf_name = JniUtil::toJavaString(env, &(thread_status->cf_name), true); if (env->ExceptionCheck()) { - // an error occurred - env->DeleteLocalRef(jdb_name); - return nullptr; + // an error occurred + env->DeleteLocalRef(jdb_name); + return nullptr; } // long[] const jsize len = static_cast( ROCKSDB_NAMESPACE::ThreadStatus::kNumOperationProperties); - jlongArray joperation_properties = - env->NewLongArray(len); + jlongArray joperation_properties = env->NewLongArray(len); if (joperation_properties == nullptr) { // an exception occurred env->DeleteLocalRef(jdb_name); @@ -7006,11 +7054,11 @@ class ThreadStatusJni : public JavaClass { jboolean is_copy; jlong* body = env->GetLongArrayElements(joperation_properties, &is_copy); if (body == nullptr) { - // exception thrown: OutOfMemoryError - env->DeleteLocalRef(jdb_name); - env->DeleteLocalRef(jcf_name); - env->DeleteLocalRef(joperation_properties); - return nullptr; + // exception thrown: OutOfMemoryError + env->DeleteLocalRef(jdb_name); + env->DeleteLocalRef(jcf_name); + env->DeleteLocalRef(joperation_properties); + return nullptr; } for (size_t i = 0; i < len; ++i) { body[i] = static_cast(thread_status->op_properties[i]); @@ -7018,10 +7066,9 @@ class ThreadStatusJni : public JavaClass { env->ReleaseLongArrayElements(joperation_properties, body, is_copy == JNI_TRUE ? 0 : JNI_ABORT); - jobject jcfd = env->NewObject(jclazz, mid, - static_cast(thread_status->thread_id), - ThreadTypeJni::toJavaThreadType(thread_status->thread_type), - jdb_name, + jobject jcfd = env->NewObject( + jclazz, mid, static_cast(thread_status->thread_id), + ThreadTypeJni::toJavaThreadType(thread_status->thread_type), jdb_name, jcf_name, OperationTypeJni::toJavaOperationType(thread_status->operation_type), static_cast(thread_status->op_elapsed_micros), @@ -7030,9 +7077,9 @@ class ThreadStatusJni : public JavaClass { StateTypeJni::toJavaStateType(thread_status->state_type)); if (env->ExceptionCheck()) { // exception occurred - env->DeleteLocalRef(jdb_name); - env->DeleteLocalRef(jcf_name); - env->DeleteLocalRef(joperation_properties); + env->DeleteLocalRef(jdb_name); + env->DeleteLocalRef(jcf_name); + env->DeleteLocalRef(joperation_properties); return nullptr; } @@ -7226,7 +7273,8 @@ class LogFileJni : public JavaClass { return nullptr; } - jmethodID mid = env->GetMethodID(jclazz, "", "(Ljava/lang/String;JBJJ)V"); + jmethodID mid = + env->GetMethodID(jclazz, "", "(Ljava/lang/String;JBJJ)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; @@ -7281,7 +7329,9 @@ class LiveFileMetaDataJni : public JavaClass { return nullptr; } - jmethodID mid = env->GetMethodID(jclazz, "", "([BILjava/lang/String;Ljava/lang/String;JJJ[B[BJZJJ)V"); + jmethodID mid = env->GetMethodID( + jclazz, "", + "([BILjava/lang/String;Ljava/lang/String;JJJ[B[BJZJJ)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; @@ -7332,21 +7382,17 @@ class LiveFileMetaDataJni : public JavaClass { return nullptr; } - jobject jlive_file_meta_data = env->NewObject(jclazz, mid, - jcolumn_family_name, - static_cast(live_file_meta_data->level), - jfile_name, - jpath, + jobject jlive_file_meta_data = env->NewObject( + jclazz, mid, jcolumn_family_name, + static_cast(live_file_meta_data->level), jfile_name, jpath, static_cast(live_file_meta_data->size), static_cast(live_file_meta_data->smallest_seqno), - static_cast(live_file_meta_data->largest_seqno), - jsmallest_key, + static_cast(live_file_meta_data->largest_seqno), jsmallest_key, jlargest_key, static_cast(live_file_meta_data->num_reads_sampled), static_cast(live_file_meta_data->being_compacted), static_cast(live_file_meta_data->num_entries), - static_cast(live_file_meta_data->num_deletions) - ); + static_cast(live_file_meta_data->num_deletions)); if (env->ExceptionCheck()) { env->DeleteLocalRef(jcolumn_family_name); @@ -7392,7 +7438,8 @@ class SstFileMetaDataJni : public JavaClass { return nullptr; } - jmethodID mid = env->GetMethodID(jclazz, "", "(Ljava/lang/String;Ljava/lang/String;JJJ[B[BJZJJ)V"); + jmethodID mid = env->GetMethodID( + jclazz, "", "(Ljava/lang/String;Ljava/lang/String;JJJ[B[BJZJJ)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; @@ -7432,19 +7479,15 @@ class SstFileMetaDataJni : public JavaClass { return nullptr; } - jobject jsst_file_meta_data = env->NewObject(jclazz, mid, - jfile_name, - jpath, + jobject jsst_file_meta_data = env->NewObject( + jclazz, mid, jfile_name, jpath, static_cast(sst_file_meta_data->size), static_cast(sst_file_meta_data->smallest_seqno), - static_cast(sst_file_meta_data->largest_seqno), - jsmallest_key, - jlargest_key, - static_cast(sst_file_meta_data->num_reads_sampled), + static_cast(sst_file_meta_data->largest_seqno), jsmallest_key, + jlargest_key, static_cast(sst_file_meta_data->num_reads_sampled), static_cast(sst_file_meta_data->being_compacted), static_cast(sst_file_meta_data->num_entries), - static_cast(sst_file_meta_data->num_deletions) - ); + static_cast(sst_file_meta_data->num_deletions)); if (env->ExceptionCheck()) { env->DeleteLocalRef(jfile_name); @@ -7455,10 +7498,10 @@ class SstFileMetaDataJni : public JavaClass { } // cleanup - env->DeleteLocalRef(jfile_name); - env->DeleteLocalRef(jpath); - env->DeleteLocalRef(jsmallest_key); - env->DeleteLocalRef(jlargest_key); + env->DeleteLocalRef(jfile_name); + env->DeleteLocalRef(jpath); + env->DeleteLocalRef(jsmallest_key); + env->DeleteLocalRef(jlargest_key); return jsst_file_meta_data; } @@ -7487,15 +7530,16 @@ class LevelMetaDataJni : public JavaClass { return nullptr; } - jmethodID mid = env->GetMethodID(jclazz, "", "(IJ[Lorg/rocksdb/SstFileMetaData;)V"); + jmethodID mid = env->GetMethodID(jclazz, "", + "(IJ[Lorg/rocksdb/SstFileMetaData;)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; } - const jsize jlen = - static_cast(level_meta_data->files.size()); - jobjectArray jfiles = env->NewObjectArray(jlen, SstFileMetaDataJni::getJClass(env), nullptr); + const jsize jlen = static_cast(level_meta_data->files.size()); + jobjectArray jfiles = + env->NewObjectArray(jlen, SstFileMetaDataJni::getJClass(env), nullptr); if (jfiles == nullptr) { // exception thrown: OutOfMemoryError return nullptr; @@ -7503,7 +7547,7 @@ class LevelMetaDataJni : public JavaClass { jsize i = 0; for (auto it = level_meta_data->files.begin(); - it != level_meta_data->files.end(); ++it) { + it != level_meta_data->files.end(); ++it) { jobject jfile = SstFileMetaDataJni::fromCppSstFileMetaData(env, &(*it)); if (jfile == nullptr) { // exception occurred @@ -7513,11 +7557,9 @@ class LevelMetaDataJni : public JavaClass { env->SetObjectArrayElement(jfiles, i++, jfile); } - jobject jlevel_meta_data = env->NewObject(jclazz, mid, - static_cast(level_meta_data->level), - static_cast(level_meta_data->size), - jfiles - ); + jobject jlevel_meta_data = + env->NewObject(jclazz, mid, static_cast(level_meta_data->level), + static_cast(level_meta_data->size), jfiles); if (env->ExceptionCheck()) { env->DeleteLocalRef(jfiles); @@ -7555,7 +7597,8 @@ class ColumnFamilyMetaDataJni : public JavaClass { return nullptr; } - jmethodID mid = env->GetMethodID(jclazz, "", "(JJ[B[Lorg/rocksdb/LevelMetaData;)V"); + jmethodID mid = env->GetMethodID(jclazz, "", + "(JJ[B[Lorg/rocksdb/LevelMetaData;)V"); if (mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return nullptr; @@ -7570,8 +7613,9 @@ class ColumnFamilyMetaDataJni : public JavaClass { const jsize jlen = static_cast(column_famly_meta_data->levels.size()); - jobjectArray jlevels = env->NewObjectArray(jlen, LevelMetaDataJni::getJClass(env), nullptr); - if(jlevels == nullptr) { + jobjectArray jlevels = + env->NewObjectArray(jlen, LevelMetaDataJni::getJClass(env), nullptr); + if (jlevels == nullptr) { // exception thrown: OutOfMemoryError env->DeleteLocalRef(jname); return nullptr; @@ -7579,7 +7623,7 @@ class ColumnFamilyMetaDataJni : public JavaClass { jsize i = 0; for (auto it = column_famly_meta_data->levels.begin(); - it != column_famly_meta_data->levels.end(); ++it) { + it != column_famly_meta_data->levels.end(); ++it) { jobject jlevel = LevelMetaDataJni::fromCppLevelMetaData(env, &(*it)); if (jlevel == nullptr) { // exception occurred @@ -7590,12 +7634,9 @@ class ColumnFamilyMetaDataJni : public JavaClass { env->SetObjectArrayElement(jlevels, i++, jlevel); } - jobject jcolumn_family_meta_data = env->NewObject(jclazz, mid, - static_cast(column_famly_meta_data->size), - static_cast(column_famly_meta_data->file_count), - jname, - jlevels - ); + jobject jcolumn_family_meta_data = env->NewObject( + jclazz, mid, static_cast(column_famly_meta_data->size), + static_cast(column_famly_meta_data->file_count), jname, jlevels); if (env->ExceptionCheck()) { env->DeleteLocalRef(jname); @@ -7632,7 +7673,7 @@ class AbstractTraceWriterJni */ static jclass getJClass(JNIEnv* env) { return RocksDBNativeClass::getJClass(env, - "org/rocksdb/AbstractTraceWriter"); + "org/rocksdb/AbstractTraceWriter"); } /** @@ -7645,13 +7686,12 @@ class AbstractTraceWriterJni */ static jmethodID getWriteProxyMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "writeProxy", "(J)S"); + static jmethodID mid = env->GetMethodID(jclazz, "writeProxy", "(J)S"); assert(mid != nullptr); return mid; } @@ -7666,13 +7706,12 @@ class AbstractTraceWriterJni */ static jmethodID getCloseWriterProxyMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "closeWriterProxy", "()S"); + static jmethodID mid = env->GetMethodID(jclazz, "closeWriterProxy", "()S"); assert(mid != nullptr); return mid; } @@ -7687,13 +7726,12 @@ class AbstractTraceWriterJni */ static jmethodID getGetFileSizeMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "getFileSize", "()J"); + static jmethodID mid = env->GetMethodID(jclazz, "getFileSize", "()J"); assert(mid != nullptr); return mid; } @@ -7714,8 +7752,7 @@ class AbstractWalFilterJni * OutOfMemoryError or ExceptionInInitializerError exceptions is thrown */ static jclass getJClass(JNIEnv* env) { - return RocksDBNativeClass::getJClass(env, - "org/rocksdb/AbstractWalFilter"); + return RocksDBNativeClass::getJClass(env, "org/rocksdb/AbstractWalFilter"); } /** @@ -7728,14 +7765,14 @@ class AbstractWalFilterJni */ static jmethodID getColumnFamilyLogNumberMapMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "columnFamilyLogNumberMap", - "(Ljava/util/Map;Ljava/util/Map;)V"); + static jmethodID mid = + env->GetMethodID(jclazz, "columnFamilyLogNumberMap", + "(Ljava/util/Map;Ljava/util/Map;)V"); assert(mid != nullptr); return mid; } @@ -7750,13 +7787,13 @@ class AbstractWalFilterJni */ static jmethodID getLogRecordFoundProxyMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "logRecordFoundProxy", "(JLjava/lang/String;JJ)S"); + static jmethodID mid = env->GetMethodID(jclazz, "logRecordFoundProxy", + "(JLjava/lang/String;JJ)S"); assert(mid != nullptr); return mid; } @@ -7771,13 +7808,13 @@ class AbstractWalFilterJni */ static jmethodID getNameMethodId(JNIEnv* env) { jclass jclazz = getJClass(env); - if(jclazz == nullptr) { + if (jclazz == nullptr) { // exception occurred accessing class return nullptr; } - static jmethodID mid = env->GetMethodID( - jclazz, "name", "()Ljava/lang/String;"); + static jmethodID mid = + env->GetMethodID(jclazz, "name", "()Ljava/lang/String;"); assert(mid != nullptr); return mid; } @@ -7840,7 +7877,7 @@ class ReusedSynchronisationTypeJni { static jbyte toJavaReusedSynchronisationType( const ROCKSDB_NAMESPACE::ReusedSynchronisationType& reused_synchronisation_type) { - switch(reused_synchronisation_type) { + switch (reused_synchronisation_type) { case ROCKSDB_NAMESPACE::ReusedSynchronisationType::MUTEX: return 0x0; case ROCKSDB_NAMESPACE::ReusedSynchronisationType::ADAPTIVE_MUTEX: @@ -7856,7 +7893,7 @@ class ReusedSynchronisationTypeJni { // enum for the provided Java org.rocksdb.ReusedSynchronisationType static ROCKSDB_NAMESPACE::ReusedSynchronisationType toCppReusedSynchronisationType(jbyte reused_synchronisation_type) { - switch(reused_synchronisation_type) { + switch (reused_synchronisation_type) { case 0x0: return ROCKSDB_NAMESPACE::ReusedSynchronisationType::MUTEX; case 0x1: @@ -7875,7 +7912,7 @@ class SanityLevelJni { // Returns the equivalent org.rocksdb.SanityLevel for the provided // C++ ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel enum static jbyte toJavaSanityLevel( - const ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel &sanity_level) { + const ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel& sanity_level) { switch (sanity_level) { case ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel::kSanityLevelNone: return 0x0; @@ -7890,8 +7927,8 @@ class SanityLevelJni { } } - // Returns the equivalent C++ ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel enum for - // the provided Java org.rocksdb.SanityLevel + // Returns the equivalent C++ ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel + // enum for the provided Java org.rocksdb.SanityLevel static ROCKSDB_NAMESPACE::ConfigOptions::SanityLevel toCppSanityLevel( jbyte sanity_level) { switch (sanity_level) { diff --git a/java/rocksjni/rocksdb_exception_test.cc b/java/rocksjni/rocksdb_exception_test.cc index d0fd834ba..67e62f726 100644 --- a/java/rocksjni/rocksdb_exception_test.cc +++ b/java/rocksjni/rocksdb_exception_test.cc @@ -6,7 +6,6 @@ #include #include "include/org_rocksdb_RocksDBExceptionTest.h" - #include "rocksdb/slice.h" #include "rocksdb/status.h" #include "rocksjni/portal.h" diff --git a/java/rocksjni/rocksjni.cc b/java/rocksjni/rocksjni.cc index fca7074ed..23fa60467 100644 --- a/java/rocksjni/rocksjni.cc +++ b/java/rocksjni/rocksjni.cc @@ -61,8 +61,9 @@ jlong rocksdb_open_helper(JNIEnv* env, jlong jopt_handle, jstring jdb_path, * Method: open * Signature: (JLjava/lang/String;)J */ -jlong Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2( - JNIEnv* env, jclass, jlong jopt_handle, jstring jdb_path) { +jlong Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2(JNIEnv* env, jclass, + jlong jopt_handle, + jstring jdb_path) { return rocksdb_open_helper(env, jopt_handle, jdb_path, (ROCKSDB_NAMESPACE::Status(*)( const ROCKSDB_NAMESPACE::Options&, @@ -288,8 +289,7 @@ Java_org_rocksdb_RocksDB_openAsSecondary__JLjava_lang_String_2Ljava_lang_String_ * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_RocksDB_disposeInternal(JNIEnv*, jobject, jlong jhandle) { auto* db = reinterpret_cast(jhandle); assert(db != nullptr); delete db; @@ -300,8 +300,8 @@ void Java_org_rocksdb_RocksDB_disposeInternal( * Method: closeDatabase * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_closeDatabase( - JNIEnv* env, jclass, jlong jhandle) { +void Java_org_rocksdb_RocksDB_closeDatabase(JNIEnv* env, jclass, + jlong jhandle) { auto* db = reinterpret_cast(jhandle); assert(db != nullptr); ROCKSDB_NAMESPACE::Status s = db->Close(); @@ -313,8 +313,9 @@ void Java_org_rocksdb_RocksDB_closeDatabase( * Method: listColumnFamilies * Signature: (JLjava/lang/String;)[[B */ -jobjectArray Java_org_rocksdb_RocksDB_listColumnFamilies( - JNIEnv* env, jclass, jlong jopt_handle, jstring jdb_path) { +jobjectArray Java_org_rocksdb_RocksDB_listColumnFamilies(JNIEnv* env, jclass, + jlong jopt_handle, + jstring jdb_path) { std::vector column_family_names; const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { @@ -339,9 +340,11 @@ jobjectArray Java_org_rocksdb_RocksDB_listColumnFamilies( * Method: createColumnFamily * Signature: (J[BIJ)J */ -jlong Java_org_rocksdb_RocksDB_createColumnFamily( - JNIEnv* env, jobject, jlong jhandle, jbyteArray jcf_name, - jint jcf_name_len, jlong jcf_options_handle) { +jlong Java_org_rocksdb_RocksDB_createColumnFamily(JNIEnv* env, jobject, + jlong jhandle, + jbyteArray jcf_name, + jint jcf_name_len, + jlong jcf_options_handle) { auto* db = reinterpret_cast(jhandle); jboolean has_exception = JNI_FALSE; const std::string cf_name = @@ -424,9 +427,9 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( jlong* jcf_options_handles_elems = env->GetLongArrayElements(jcf_options_handles, nullptr); - if(jcf_options_handles_elems == nullptr) { - // exception thrown: OutOfMemoryError - return nullptr; + if (jcf_options_handles_elems == nullptr) { + // exception thrown: OutOfMemoryError + return nullptr; } // extract the column family descriptors @@ -435,11 +438,12 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( auto* cf_options = reinterpret_cast( jcf_options_handles_elems[i]); - jbyteArray jcf_name = static_cast( - env->GetObjectArrayElement(jcf_names, i)); + jbyteArray jcf_name = + static_cast(env->GetObjectArrayElement(jcf_names, i)); if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException - env->ReleaseLongArrayElements(jcf_options_handles, jcf_options_handles_elems, JNI_ABORT); + env->ReleaseLongArrayElements(jcf_options_handles, + jcf_options_handles_elems, JNI_ABORT); return nullptr; } const std::string cf_name = @@ -452,7 +456,8 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( if (has_exception == JNI_TRUE) { // exception occurred env->DeleteLocalRef(jcf_name); - env->ReleaseLongArrayElements(jcf_options_handles, jcf_options_handles_elems, JNI_ABORT); + env->ReleaseLongArrayElements(jcf_options_handles, + jcf_options_handles_elems, JNI_ABORT); return nullptr; } @@ -466,7 +471,8 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( ROCKSDB_NAMESPACE::Status s = db->CreateColumnFamilies(cf_descriptors, &cf_handles); - env->ReleaseLongArrayElements(jcf_options_handles, jcf_options_handles_elems, JNI_ABORT); + env->ReleaseLongArrayElements(jcf_options_handles, jcf_options_handles_elems, + JNI_ABORT); if (!s.ok()) { // error occurred @@ -488,9 +494,9 @@ jlongArray Java_org_rocksdb_RocksDB_createColumnFamilies__J_3J_3_3B( * Method: dropColumnFamily * Signature: (JJ)V; */ -void Java_org_rocksdb_RocksDB_dropColumnFamily( - JNIEnv* env, jobject, jlong jdb_handle, - jlong jcf_handle) { +void Java_org_rocksdb_RocksDB_dropColumnFamily(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jcf_handle) { auto* db_handle = reinterpret_cast(jdb_handle); auto* cf_handle = reinterpret_cast(jcf_handle); @@ -506,8 +512,7 @@ void Java_org_rocksdb_RocksDB_dropColumnFamily( * Signature: (J[J)V */ void Java_org_rocksdb_RocksDB_dropColumnFamilies( - JNIEnv* env, jobject, jlong jdb_handle, - jlongArray jcolumn_family_handles) { + JNIEnv* env, jobject, jlong jdb_handle, jlongArray jcolumn_family_handles) { auto* db_handle = reinterpret_cast(jdb_handle); std::vector cf_handles; @@ -591,15 +596,16 @@ bool rocksdb_put_helper(JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, * Method: put * Signature: (J[BII[BII)V */ -void Java_org_rocksdb_RocksDB_put__J_3BII_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { +void Java_org_rocksdb_RocksDB_put__J_3BII_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_put_helper(env, db, default_write_options, nullptr, jkey, jkey_off, - jkey_len, jval, jval_off, jval_len); + jkey_len, jval, jval_off, jval_len); } /* @@ -607,11 +613,12 @@ void Java_org_rocksdb_RocksDB_put__J_3BII_3BII( * Method: put * Signature: (J[BII[BIIJ)V */ -void Java_org_rocksdb_RocksDB_put__J_3BII_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, - jlong jcf_handle) { +void Java_org_rocksdb_RocksDB_put__J_3BII_3BIIJ(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); @@ -619,7 +626,7 @@ void Java_org_rocksdb_RocksDB_put__J_3BII_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_put_helper(env, db, default_write_options, cf_handle, jkey, - jkey_off, jkey_len, jval, jval_off, jval_len); + jkey_off, jkey_len, jval, jval_off, jval_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -632,16 +639,17 @@ void Java_org_rocksdb_RocksDB_put__J_3BII_3BIIJ( * Method: put * Signature: (JJ[BII[BII)V */ -void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jlong jwrite_options_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { +void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jwrite_options_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options_handle); rocksdb_put_helper(env, db, *write_options, nullptr, jkey, jkey_off, jkey_len, - jval, jval_off, jval_len); + jval, jval_off, jval_len); } /* @@ -651,9 +659,8 @@ void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BII( */ void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, - jlong jcf_handle) { + jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len, jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options_handle); @@ -661,7 +668,7 @@ void Java_org_rocksdb_RocksDB_put__JJ_3BII_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_put_helper(env, db, *write_options, cf_handle, jkey, jkey_off, - jkey_len, jval, jval_off, jval_len); + jkey_len, jval, jval_off, jval_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -744,14 +751,14 @@ bool rocksdb_delete_helper(JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, * Method: delete * Signature: (J[BII)V */ -void Java_org_rocksdb_RocksDB_delete__J_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len) { +void Java_org_rocksdb_RocksDB_delete__J_3BII(JNIEnv* env, jobject, + jlong jdb_handle, jbyteArray jkey, + jint jkey_off, jint jkey_len) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_delete_helper(env, db, default_write_options, nullptr, jkey, jkey_off, - jkey_len); + jkey_len); } /* @@ -759,10 +766,10 @@ void Java_org_rocksdb_RocksDB_delete__J_3BII( * Method: delete * Signature: (J[BIIJ)V */ -void Java_org_rocksdb_RocksDB_delete__J_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jlong jcf_handle) { +void Java_org_rocksdb_RocksDB_delete__J_3BIIJ(JNIEnv* env, jobject, + jlong jdb_handle, jbyteArray jkey, + jint jkey_off, jint jkey_len, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); @@ -770,7 +777,7 @@ void Java_org_rocksdb_RocksDB_delete__J_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_helper(env, db, default_write_options, cf_handle, jkey, - jkey_off, jkey_len); + jkey_off, jkey_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -783,16 +790,16 @@ void Java_org_rocksdb_RocksDB_delete__J_3BIIJ( * Method: delete * Signature: (JJ[BII)V */ -void Java_org_rocksdb_RocksDB_delete__JJ_3BII( - JNIEnv* env, jobject, - jlong jdb_handle, - jlong jwrite_options, - jbyteArray jkey, jint jkey_off, jint jkey_len) { +void Java_org_rocksdb_RocksDB_delete__JJ_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jwrite_options, + jbyteArray jkey, jint jkey_off, + jint jkey_len) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options); rocksdb_delete_helper(env, db, *write_options, nullptr, jkey, jkey_off, - jkey_len); + jkey_len); } /* @@ -810,7 +817,7 @@ void Java_org_rocksdb_RocksDB_delete__JJ_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_helper(env, db, *write_options, cf_handle, jkey, jkey_off, - jkey_len); + jkey_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -861,16 +868,15 @@ bool rocksdb_single_delete_helper( * Method: singleDelete * Signature: (J[BI)V */ -void Java_org_rocksdb_RocksDB_singleDelete__J_3BI( - JNIEnv* env, jobject, - jlong jdb_handle, - jbyteArray jkey, - jint jkey_len) { +void Java_org_rocksdb_RocksDB_singleDelete__J_3BI(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, + jint jkey_len) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); - rocksdb_single_delete_helper(env, db, default_write_options, nullptr, - jkey, jkey_len); + rocksdb_single_delete_helper(env, db, default_write_options, nullptr, jkey, + jkey_len); } /* @@ -878,9 +884,11 @@ void Java_org_rocksdb_RocksDB_singleDelete__J_3BI( * Method: singleDelete * Signature: (J[BIJ)V */ -void Java_org_rocksdb_RocksDB_singleDelete__J_3BIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_len, jlong jcf_handle) { +void Java_org_rocksdb_RocksDB_singleDelete__J_3BIJ(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, + jint jkey_len, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); @@ -888,7 +896,7 @@ void Java_org_rocksdb_RocksDB_singleDelete__J_3BIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_single_delete_helper(env, db, default_write_options, cf_handle, - jkey, jkey_len); + jkey, jkey_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -901,16 +909,16 @@ void Java_org_rocksdb_RocksDB_singleDelete__J_3BIJ( * Method: singleDelete * Signature: (JJ[BIJ)V */ -void Java_org_rocksdb_RocksDB_singleDelete__JJ_3BI( - JNIEnv* env, jobject, jlong jdb_handle, - jlong jwrite_options, - jbyteArray jkey, - jint jkey_len) { +void Java_org_rocksdb_RocksDB_singleDelete__JJ_3BI(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jwrite_options, + jbyteArray jkey, + jint jkey_len) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options); rocksdb_single_delete_helper(env, db, *write_options, nullptr, jkey, - jkey_len); + jkey_len); } /* @@ -928,7 +936,7 @@ void Java_org_rocksdb_RocksDB_singleDelete__JJ_3BIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_single_delete_helper(env, db, *write_options, cf_handle, jkey, - jkey_len); + jkey_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -950,7 +958,7 @@ bool rocksdb_delete_range_helper( jint jend_key_off, jint jend_key_len) { jbyte* begin_key = new jbyte[jbegin_key_len]; env->GetByteArrayRegion(jbegin_key, jbegin_key_off, jbegin_key_len, - begin_key); + begin_key); if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException delete[] begin_key; @@ -991,15 +999,15 @@ bool rocksdb_delete_range_helper( * Signature: (J[BII[BII)V */ void Java_org_rocksdb_RocksDB_deleteRange__J_3BII_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, - jbyteArray jend_key, jint jend_key_off, jint jend_key_len) { + JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jbegin_key, + jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, + jint jend_key_off, jint jend_key_len) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_delete_range_helper(env, db, default_write_options, nullptr, - jbegin_key, jbegin_key_off, jbegin_key_len, - jend_key, jend_key_off, jend_key_len); + jbegin_key, jbegin_key_off, jbegin_key_len, + jend_key, jend_key_off, jend_key_len); } jint rocksdb_get_helper_direct( @@ -1095,10 +1103,9 @@ jint rocksdb_get_helper_direct( * Signature: (J[BII[BIIJ)V */ void Java_org_rocksdb_RocksDB_deleteRange__J_3BII_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jbegin_key, jint jbegin_key_off, jint jbegin_key_len, - jbyteArray jend_key, jint jend_key_off, jint jend_key_len, - jlong jcf_handle) { + JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jbegin_key, + jint jbegin_key_off, jint jbegin_key_len, jbyteArray jend_key, + jint jend_key_off, jint jend_key_len, jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); @@ -1106,8 +1113,8 @@ void Java_org_rocksdb_RocksDB_deleteRange__J_3BII_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_delete_range_helper(env, db, default_write_options, cf_handle, - jbegin_key, jbegin_key_off, jbegin_key_len, - jend_key, jend_key_off, jend_key_len); + jbegin_key, jbegin_key_off, jbegin_key_len, + jend_key, jend_key_off, jend_key_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -1128,8 +1135,8 @@ void Java_org_rocksdb_RocksDB_deleteRange__JJ_3BII_3BII( auto* write_options = reinterpret_cast(jwrite_options); rocksdb_delete_range_helper(env, db, *write_options, nullptr, jbegin_key, - jbegin_key_off, jbegin_key_len, jend_key, - jend_key_off, jend_key_len); + jbegin_key_off, jbegin_key_len, jend_key, + jend_key_off, jend_key_len); } /* @@ -1148,9 +1155,9 @@ void Java_org_rocksdb_RocksDB_deleteRange__JJ_3BII_3BIIJ( auto* cf_handle = reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { - rocksdb_delete_range_helper(env, db, *write_options, cf_handle, - jbegin_key, jbegin_key_off, jbegin_key_len, - jend_key, jend_key_off, jend_key_len); + rocksdb_delete_range_helper(env, db, *write_options, cf_handle, jbegin_key, + jbegin_key_off, jbegin_key_len, jend_key, + jend_key_off, jend_key_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -1236,15 +1243,16 @@ bool rocksdb_merge_helper(JNIEnv* env, ROCKSDB_NAMESPACE::DB* db, * Method: merge * Signature: (J[BII[BII)V */ -void Java_org_rocksdb_RocksDB_merge__J_3BII_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { +void Java_org_rocksdb_RocksDB_merge__J_3BII_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = ROCKSDB_NAMESPACE::WriteOptions(); rocksdb_merge_helper(env, db, default_write_options, nullptr, jkey, jkey_off, - jkey_len, jval, jval_off, jval_len); + jkey_len, jval, jval_off, jval_len); } /* @@ -1253,9 +1261,8 @@ void Java_org_rocksdb_RocksDB_merge__J_3BII_3BII( * Signature: (J[BII[BIIJ)V */ void Java_org_rocksdb_RocksDB_merge__J_3BII_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, + JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); static const ROCKSDB_NAMESPACE::WriteOptions default_write_options = @@ -1264,7 +1271,7 @@ void Java_org_rocksdb_RocksDB_merge__J_3BII_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_merge_helper(env, db, default_write_options, cf_handle, jkey, - jkey_off, jkey_len, jval, jval_off, jval_len); + jkey_off, jkey_len, jval, jval_off, jval_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -1279,13 +1286,13 @@ void Java_org_rocksdb_RocksDB_merge__J_3BII_3BIIJ( */ void Java_org_rocksdb_RocksDB_merge__JJ_3BII_3BII( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { + jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options_handle); rocksdb_merge_helper(env, db, *write_options, nullptr, jkey, jkey_off, - jkey_len, jval, jval_off, jval_len); + jkey_len, jval, jval_off, jval_len); } /* @@ -1295,8 +1302,8 @@ void Java_org_rocksdb_RocksDB_merge__JJ_3BII_3BII( */ void Java_org_rocksdb_RocksDB_merge__JJ_3BII_3BIIJ( JNIEnv* env, jobject, jlong jdb_handle, jlong jwrite_options_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { + jbyteArray jkey, jint jkey_off, jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len, jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options_handle); @@ -1304,7 +1311,7 @@ void Java_org_rocksdb_RocksDB_merge__JJ_3BII_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { rocksdb_merge_helper(env, db, *write_options, cf_handle, jkey, jkey_off, - jkey_len, jval, jval_off, jval_len); + jkey_len, jval, jval_off, jval_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -1363,9 +1370,9 @@ void Java_org_rocksdb_RocksDB_deleteDirect(JNIEnv* env, jobject /*jdb*/, * Method: write0 * Signature: (JJJ)V */ -void Java_org_rocksdb_RocksDB_write0( - JNIEnv* env, jobject, jlong jdb_handle, - jlong jwrite_options_handle, jlong jwb_handle) { +void Java_org_rocksdb_RocksDB_write0(JNIEnv* env, jobject, jlong jdb_handle, + jlong jwrite_options_handle, + jlong jwb_handle) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options_handle); @@ -1383,9 +1390,9 @@ void Java_org_rocksdb_RocksDB_write0( * Method: write1 * Signature: (JJJ)V */ -void Java_org_rocksdb_RocksDB_write1( - JNIEnv* env, jobject, jlong jdb_handle, - jlong jwrite_options_handle, jlong jwbwi_handle) { +void Java_org_rocksdb_RocksDB_write1(JNIEnv* env, jobject, jlong jdb_handle, + jlong jwrite_options_handle, + jlong jwbwi_handle) { auto* db = reinterpret_cast(jdb_handle); auto* write_options = reinterpret_cast(jwrite_options_handle); @@ -1452,9 +1459,10 @@ jbyteArray rocksdb_get_helper( * Method: get * Signature: (J[BII)[B */ -jbyteArray Java_org_rocksdb_RocksDB_get__J_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len) { +jbyteArray Java_org_rocksdb_RocksDB_get__J_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len) { return rocksdb_get_helper( env, reinterpret_cast(jdb_handle), ROCKSDB_NAMESPACE::ReadOptions(), nullptr, jkey, jkey_off, jkey_len); @@ -1465,9 +1473,11 @@ jbyteArray Java_org_rocksdb_RocksDB_get__J_3BII( * Method: get * Signature: (J[BIIJ)[B */ -jbyteArray Java_org_rocksdb_RocksDB_get__J_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, jlong jcf_handle) { +jbyteArray Java_org_rocksdb_RocksDB_get__J_3BIIJ(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, + jlong jcf_handle) { auto db_handle = reinterpret_cast(jdb_handle); auto cf_handle = reinterpret_cast(jcf_handle); @@ -1487,10 +1497,11 @@ jbyteArray Java_org_rocksdb_RocksDB_get__J_3BIIJ( * Method: get * Signature: (JJ[BII)[B */ -jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BII( - JNIEnv* env, jobject, - jlong jdb_handle, jlong jropt_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len) { +jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jropt_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len) { return rocksdb_get_helper( env, reinterpret_cast(jdb_handle), *reinterpret_cast(jropt_handle), nullptr, @@ -1503,16 +1514,16 @@ jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BII( * Signature: (JJ[BIIJ)[B */ jbyteArray Java_org_rocksdb_RocksDB_get__JJ_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, jlong jropt_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, jlong jcf_handle) { + JNIEnv* env, jobject, jlong jdb_handle, jlong jropt_handle, jbyteArray jkey, + jint jkey_off, jint jkey_len, jlong jcf_handle) { auto* db_handle = reinterpret_cast(jdb_handle); auto& ro_opt = *reinterpret_cast(jropt_handle); auto* cf_handle = reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { - return rocksdb_get_helper( - env, db_handle, ro_opt, cf_handle, jkey, jkey_off, jkey_len); + return rocksdb_get_helper(env, db_handle, ro_opt, cf_handle, jkey, jkey_off, + jkey_len); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -1592,10 +1603,11 @@ jint rocksdb_get_helper( * Method: get * Signature: (J[BII[BII)I */ -jint Java_org_rocksdb_RocksDB_get__J_3BII_3BII( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { +jint Java_org_rocksdb_RocksDB_get__J_3BII_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len) { bool has_exception = false; return rocksdb_get_helper( env, reinterpret_cast(jdb_handle), @@ -1608,11 +1620,12 @@ jint Java_org_rocksdb_RocksDB_get__J_3BII_3BII( * Method: get * Signature: (J[BII[BIIJ)I */ -jint Java_org_rocksdb_RocksDB_get__J_3BII_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, - jlong jcf_handle) { +jint Java_org_rocksdb_RocksDB_get__J_3BII_3BIIJ(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len, + jlong jcf_handle) { auto* db_handle = reinterpret_cast(jdb_handle); auto* cf_handle = reinterpret_cast(jcf_handle); @@ -1635,10 +1648,12 @@ jint Java_org_rocksdb_RocksDB_get__J_3BII_3BIIJ( * Method: get * Signature: (JJ[BII[BII)I */ -jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BII( - JNIEnv* env, jobject, jlong jdb_handle, jlong jropt_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len) { +jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BII(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jropt_handle, + jbyteArray jkey, jint jkey_off, + jint jkey_len, jbyteArray jval, + jint jval_off, jint jval_len) { bool has_exception = false; return rocksdb_get_helper( env, reinterpret_cast(jdb_handle), @@ -1652,9 +1667,8 @@ jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BII( * Signature: (JJ[BII[BIIJ)I */ jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BIIJ( - JNIEnv* env, jobject, jlong jdb_handle, jlong jropt_handle, - jbyteArray jkey, jint jkey_off, jint jkey_len, - jbyteArray jval, jint jval_off, jint jval_len, + JNIEnv* env, jobject, jlong jdb_handle, jlong jropt_handle, jbyteArray jkey, + jint jkey_off, jint jkey_len, jbyteArray jval, jint jval_off, jint jval_len, jlong jcf_handle) { auto* db_handle = reinterpret_cast(jdb_handle); auto& ro_opt = @@ -1663,10 +1677,9 @@ jint Java_org_rocksdb_RocksDB_get__JJ_3BII_3BIIJ( reinterpret_cast(jcf_handle); if (cf_handle != nullptr) { bool has_exception = false; - return rocksdb_get_helper(env, db_handle, ro_opt, cf_handle, - jkey, jkey_off, jkey_len, - jval, jval_off, jval_len, - &has_exception); + return rocksdb_get_helper(env, db_handle, ro_opt, cf_handle, jkey, jkey_off, + jkey_len, jval, jval_off, jval_len, + &has_exception); } else { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew( env, ROCKSDB_NAMESPACE::Status::InvalidArgument( @@ -2198,17 +2211,14 @@ bool key_may_exist_direct_helper(JNIEnv* env, jlong jdb_handle, */ jboolean Java_org_rocksdb_RocksDB_keyMayExist( JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, - jlong jread_opts_handle, - jbyteArray jkey, jint jkey_offset, jint jkey_len) { - + jlong jread_opts_handle, jbyteArray jkey, jint jkey_offset, jint jkey_len) { bool has_exception = false; std::string value; bool value_found = false; const bool exists = key_may_exist_helper( - env, jdb_handle, jcf_handle, jread_opts_handle, - jkey, jkey_offset, jkey_len, - &has_exception, &value, &value_found); + env, jdb_handle, jcf_handle, jread_opts_handle, jkey, jkey_offset, + jkey_len, &has_exception, &value, &value_found); if (has_exception) { // java exception already raised @@ -2406,8 +2416,7 @@ jobjectArray Java_org_rocksdb_RocksDB_keyMayExistFoundValue( * Method: iterator * Signature: (J)J */ -jlong Java_org_rocksdb_RocksDB_iterator__J( - JNIEnv*, jobject, jlong db_handle) { +jlong Java_org_rocksdb_RocksDB_iterator__J(JNIEnv*, jobject, jlong db_handle) { auto* db = reinterpret_cast(db_handle); return rocksdb_iterator_helper(db, ROCKSDB_NAMESPACE::ReadOptions(), nullptr); } @@ -2417,8 +2426,8 @@ jlong Java_org_rocksdb_RocksDB_iterator__J( * Method: iterator * Signature: (JJ)J */ -jlong Java_org_rocksdb_RocksDB_iterator__JJ( - JNIEnv*, jobject, jlong db_handle, jlong jread_options_handle) { +jlong Java_org_rocksdb_RocksDB_iterator__JJ(JNIEnv*, jobject, jlong db_handle, + jlong jread_options_handle) { auto* db = reinterpret_cast(db_handle); auto& read_options = *reinterpret_cast(jread_options_handle); @@ -2430,8 +2439,8 @@ jlong Java_org_rocksdb_RocksDB_iterator__JJ( * Method: iteratorCF * Signature: (JJ)J */ -jlong Java_org_rocksdb_RocksDB_iteratorCF__JJ( - JNIEnv*, jobject, jlong db_handle, jlong jcf_handle) { +jlong Java_org_rocksdb_RocksDB_iteratorCF__JJ(JNIEnv*, jobject, jlong db_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(db_handle); auto* cf_handle = reinterpret_cast(jcf_handle); @@ -2444,9 +2453,10 @@ jlong Java_org_rocksdb_RocksDB_iteratorCF__JJ( * Method: iteratorCF * Signature: (JJJ)J */ -jlong Java_org_rocksdb_RocksDB_iteratorCF__JJJ( - JNIEnv*, jobject, - jlong db_handle, jlong jcf_handle, jlong jread_options_handle) { +jlong Java_org_rocksdb_RocksDB_iteratorCF__JJJ(JNIEnv*, jobject, + jlong db_handle, + jlong jcf_handle, + jlong jread_options_handle) { auto* db = reinterpret_cast(db_handle); auto* cf_handle = reinterpret_cast(jcf_handle); @@ -2460,10 +2470,10 @@ jlong Java_org_rocksdb_RocksDB_iteratorCF__JJJ( * Method: iterators * Signature: (J[JJ)[J */ -jlongArray Java_org_rocksdb_RocksDB_iterators( - JNIEnv* env, jobject, jlong db_handle, - jlongArray jcolumn_family_handles, - jlong jread_options_handle) { +jlongArray Java_org_rocksdb_RocksDB_iterators(JNIEnv* env, jobject, + jlong db_handle, + jlongArray jcolumn_family_handles, + jlong jread_options_handle) { auto* db = reinterpret_cast(db_handle); auto& read_options = *reinterpret_cast(jread_options_handle); @@ -2520,8 +2530,7 @@ jlongArray Java_org_rocksdb_RocksDB_iterators( * Method: getSnapshot * Signature: (J)J */ -jlong Java_org_rocksdb_RocksDB_getSnapshot( - JNIEnv*, jobject, jlong db_handle) { +jlong Java_org_rocksdb_RocksDB_getSnapshot(JNIEnv*, jobject, jlong db_handle) { auto* db = reinterpret_cast(db_handle); const ROCKSDB_NAMESPACE::Snapshot* snapshot = db->GetSnapshot(); return GET_CPLUSPLUS_POINTER(snapshot); @@ -2531,9 +2540,8 @@ jlong Java_org_rocksdb_RocksDB_getSnapshot( * Method: releaseSnapshot * Signature: (JJ)V */ -void Java_org_rocksdb_RocksDB_releaseSnapshot( - JNIEnv*, jobject, jlong db_handle, - jlong snapshot_handle) { +void Java_org_rocksdb_RocksDB_releaseSnapshot(JNIEnv*, jobject, jlong db_handle, + jlong snapshot_handle) { auto* db = reinterpret_cast(db_handle); auto* snapshot = reinterpret_cast(snapshot_handle); @@ -2545,9 +2553,10 @@ void Java_org_rocksdb_RocksDB_releaseSnapshot( * Method: getProperty * Signature: (JJLjava/lang/String;I)Ljava/lang/String; */ -jstring Java_org_rocksdb_RocksDB_getProperty( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, - jstring jproperty, jint jproperty_len) { +jstring Java_org_rocksdb_RocksDB_getProperty(JNIEnv* env, jobject, + jlong jdb_handle, jlong jcf_handle, + jstring jproperty, + jint jproperty_len) { const char* property = env->GetStringUTFChars(jproperty, nullptr); if (property == nullptr) { // exception thrown: OutOfMemoryError @@ -2582,10 +2591,12 @@ jstring Java_org_rocksdb_RocksDB_getProperty( * Method: getMapProperty * Signature: (JJLjava/lang/String;I)Ljava/util/Map; */ -jobject Java_org_rocksdb_RocksDB_getMapProperty( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, - jstring jproperty, jint jproperty_len) { - const char* property = env->GetStringUTFChars(jproperty, nullptr); +jobject Java_org_rocksdb_RocksDB_getMapProperty(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jcf_handle, + jstring jproperty, + jint jproperty_len) { + const char* property = env->GetStringUTFChars(jproperty, nullptr); if (property == nullptr) { // exception thrown: OutOfMemoryError return nullptr; @@ -2619,9 +2630,11 @@ jobject Java_org_rocksdb_RocksDB_getMapProperty( * Method: getLongProperty * Signature: (JJLjava/lang/String;I)J */ -jlong Java_org_rocksdb_RocksDB_getLongProperty( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, - jstring jproperty, jint jproperty_len) { +jlong Java_org_rocksdb_RocksDB_getLongProperty(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jcf_handle, + jstring jproperty, + jint jproperty_len) { const char* property = env->GetStringUTFChars(jproperty, nullptr); if (property == nullptr) { // exception thrown: OutOfMemoryError @@ -2656,8 +2669,7 @@ jlong Java_org_rocksdb_RocksDB_getLongProperty( * Method: resetStats * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_resetStats( - JNIEnv *, jobject, jlong jdb_handle) { +void Java_org_rocksdb_RocksDB_resetStats(JNIEnv*, jobject, jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); db->ResetStats(); } @@ -2667,9 +2679,10 @@ void Java_org_rocksdb_RocksDB_resetStats( * Method: getAggregatedLongProperty * Signature: (JLjava/lang/String;I)J */ -jlong Java_org_rocksdb_RocksDB_getAggregatedLongProperty( - JNIEnv* env, jobject, jlong db_handle, - jstring jproperty, jint jproperty_len) { +jlong Java_org_rocksdb_RocksDB_getAggregatedLongProperty(JNIEnv* env, jobject, + jlong db_handle, + jstring jproperty, + jint jproperty_len) { const char* property = env->GetStringUTFChars(jproperty, nullptr); if (property == nullptr) { return 0; @@ -2794,9 +2807,7 @@ jlongArray Java_org_rocksdb_RocksDB_getApproximateMemTableStats( db->GetApproximateMemTableStats(cf_handle, range, &count, &sizes); // prepare results - jlong results[2] = { - static_cast(count), - static_cast(sizes)}; + jlong results[2] = {static_cast(count), static_cast(sizes)}; jlongArray jsizes = env->NewLongArray(2); if (jsizes == nullptr) { @@ -2819,12 +2830,12 @@ jlongArray Java_org_rocksdb_RocksDB_getApproximateMemTableStats( * Method: compactRange * Signature: (J[BI[BIJJ)V */ -void Java_org_rocksdb_RocksDB_compactRange( - JNIEnv* env, jobject, jlong jdb_handle, - jbyteArray jbegin, jint jbegin_len, - jbyteArray jend, jint jend_len, - jlong jcompact_range_opts_handle, - jlong jcf_handle) { +void Java_org_rocksdb_RocksDB_compactRange(JNIEnv* env, jobject, + jlong jdb_handle, jbyteArray jbegin, + jint jbegin_len, jbyteArray jend, + jint jend_len, + jlong jcompact_range_opts_handle, + jlong jcf_handle) { jboolean has_exception = JNI_FALSE; std::string str_begin; @@ -2892,9 +2903,9 @@ void Java_org_rocksdb_RocksDB_compactRange( * Method: setOptions * Signature: (JJ[Ljava/lang/String;[Ljava/lang/String;)V */ -void Java_org_rocksdb_RocksDB_setOptions( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle, - jobjectArray jkeys, jobjectArray jvalues) { +void Java_org_rocksdb_RocksDB_setOptions(JNIEnv* env, jobject, jlong jdb_handle, + jlong jcf_handle, jobjectArray jkeys, + jobjectArray jvalues) { const jsize len = env->GetArrayLength(jkeys); assert(len == env->GetArrayLength(jvalues)); @@ -2955,14 +2966,14 @@ void Java_org_rocksdb_RocksDB_setOptions( * Method: setDBOptions * Signature: (J[Ljava/lang/String;[Ljava/lang/String;)V */ -void Java_org_rocksdb_RocksDB_setDBOptions( - JNIEnv* env, jobject, jlong jdb_handle, - jobjectArray jkeys, jobjectArray jvalues) { +void Java_org_rocksdb_RocksDB_setDBOptions(JNIEnv* env, jobject, + jlong jdb_handle, jobjectArray jkeys, + jobjectArray jvalues) { const jsize len = env->GetArrayLength(jkeys); assert(len == env->GetArrayLength(jvalues)); std::unordered_map options_map; - for (jsize i = 0; i < len; i++) { + for (jsize i = 0; i < len; i++) { jobject jobj_key = env->GetObjectArrayElement(jkeys, i); if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException @@ -3096,8 +3107,9 @@ jobjectArray Java_org_rocksdb_RocksDB_compactFiles( std::vector output_file_names; auto s = db->CompactFiles(*compaction_opts, cf_handle, input_file_names, - static_cast(joutput_level), static_cast(joutput_path_id), - &output_file_names, compaction_job_info); + static_cast(joutput_level), + static_cast(joutput_path_id), + &output_file_names, compaction_job_info); if (!s.ok()) { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; @@ -3111,10 +3123,11 @@ jobjectArray Java_org_rocksdb_RocksDB_compactFiles( * Method: cancelAllBackgroundWork * Signature: (JZ)V */ -void Java_org_rocksdb_RocksDB_cancelAllBackgroundWork( - JNIEnv*, jobject, jlong jdb_handle, jboolean jwait) { - auto* db = reinterpret_cast(jdb_handle); - ROCKSDB_NAMESPACE::CancelAllBackgroundWork(db, jwait); +void Java_org_rocksdb_RocksDB_cancelAllBackgroundWork(JNIEnv*, jobject, + jlong jdb_handle, + jboolean jwait) { + auto* db = reinterpret_cast(jdb_handle); + ROCKSDB_NAMESPACE::CancelAllBackgroundWork(db, jwait); } /* @@ -3122,8 +3135,8 @@ void Java_org_rocksdb_RocksDB_cancelAllBackgroundWork( * Method: pauseBackgroundWork * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_pauseBackgroundWork( - JNIEnv* env, jobject, jlong jdb_handle) { +void Java_org_rocksdb_RocksDB_pauseBackgroundWork(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); auto s = db->PauseBackgroundWork(); if (!s.ok()) { @@ -3136,8 +3149,8 @@ void Java_org_rocksdb_RocksDB_pauseBackgroundWork( * Method: continueBackgroundWork * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_continueBackgroundWork( - JNIEnv* env, jobject, jlong jdb_handle) { +void Java_org_rocksdb_RocksDB_continueBackgroundWork(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); auto s = db->ContinueBackgroundWork(); if (!s.ok()) { @@ -3150,8 +3163,9 @@ void Java_org_rocksdb_RocksDB_continueBackgroundWork( * Method: enableAutoCompaction * Signature: (J[J)V */ -void Java_org_rocksdb_RocksDB_enableAutoCompaction( - JNIEnv* env, jobject, jlong jdb_handle, jlongArray jcf_handles) { +void Java_org_rocksdb_RocksDB_enableAutoCompaction(JNIEnv* env, jobject, + jlong jdb_handle, + jlongArray jcf_handles) { auto* db = reinterpret_cast(jdb_handle); jboolean has_exception = JNI_FALSE; const std::vector cf_handles = @@ -3170,8 +3184,8 @@ void Java_org_rocksdb_RocksDB_enableAutoCompaction( * Method: numberLevels * Signature: (JJ)I */ -jint Java_org_rocksdb_RocksDB_numberLevels( - JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle) { +jint Java_org_rocksdb_RocksDB_numberLevels(JNIEnv*, jobject, jlong jdb_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3188,8 +3202,9 @@ jint Java_org_rocksdb_RocksDB_numberLevels( * Method: maxMemCompactionLevel * Signature: (JJ)I */ -jint Java_org_rocksdb_RocksDB_maxMemCompactionLevel( - JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle) { +jint Java_org_rocksdb_RocksDB_maxMemCompactionLevel(JNIEnv*, jobject, + jlong jdb_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3206,8 +3221,9 @@ jint Java_org_rocksdb_RocksDB_maxMemCompactionLevel( * Method: level0StopWriteTrigger * Signature: (JJ)I */ -jint Java_org_rocksdb_RocksDB_level0StopWriteTrigger( - JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle) { +jint Java_org_rocksdb_RocksDB_level0StopWriteTrigger(JNIEnv*, jobject, + jlong jdb_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3224,8 +3240,8 @@ jint Java_org_rocksdb_RocksDB_level0StopWriteTrigger( * Method: getName * Signature: (J)Ljava/lang/String; */ -jstring Java_org_rocksdb_RocksDB_getName( - JNIEnv* env, jobject, jlong jdb_handle) { +jstring Java_org_rocksdb_RocksDB_getName(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); std::string name = db->GetName(); return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, false); @@ -3236,8 +3252,7 @@ jstring Java_org_rocksdb_RocksDB_getName( * Method: getEnv * Signature: (J)J */ -jlong Java_org_rocksdb_RocksDB_getEnv( - JNIEnv*, jobject, jlong jdb_handle) { +jlong Java_org_rocksdb_RocksDB_getEnv(JNIEnv*, jobject, jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); return GET_CPLUSPLUS_POINTER(db->GetEnv()); } @@ -3247,24 +3262,24 @@ jlong Java_org_rocksdb_RocksDB_getEnv( * Method: flush * Signature: (JJ[J)V */ -void Java_org_rocksdb_RocksDB_flush( - JNIEnv* env, jobject, jlong jdb_handle, jlong jflush_opts_handle, - jlongArray jcf_handles) { +void Java_org_rocksdb_RocksDB_flush(JNIEnv* env, jobject, jlong jdb_handle, + jlong jflush_opts_handle, + jlongArray jcf_handles) { auto* db = reinterpret_cast(jdb_handle); auto* flush_opts = reinterpret_cast(jflush_opts_handle); std::vector cf_handles; if (jcf_handles == nullptr) { - cf_handles.push_back(db->DefaultColumnFamily()); + cf_handles.push_back(db->DefaultColumnFamily()); } else { - jboolean has_exception = JNI_FALSE; - cf_handles = ROCKSDB_NAMESPACE::JniUtil::fromJPointers< - ROCKSDB_NAMESPACE::ColumnFamilyHandle>(env, jcf_handles, - &has_exception); - if (has_exception) { - // exception occurred - return; - } + jboolean has_exception = JNI_FALSE; + cf_handles = ROCKSDB_NAMESPACE::JniUtil::fromJPointers< + ROCKSDB_NAMESPACE::ColumnFamilyHandle>(env, jcf_handles, + &has_exception); + if (has_exception) { + // exception occurred + return; + } } auto s = db->Flush(*flush_opts, cf_handles); if (!s.ok()) { @@ -3277,8 +3292,8 @@ void Java_org_rocksdb_RocksDB_flush( * Method: flushWal * Signature: (JZ)V */ -void Java_org_rocksdb_RocksDB_flushWal( - JNIEnv* env, jobject, jlong jdb_handle, jboolean jsync) { +void Java_org_rocksdb_RocksDB_flushWal(JNIEnv* env, jobject, jlong jdb_handle, + jboolean jsync) { auto* db = reinterpret_cast(jdb_handle); auto s = db->FlushWAL(jsync == JNI_TRUE); if (!s.ok()) { @@ -3291,8 +3306,7 @@ void Java_org_rocksdb_RocksDB_flushWal( * Method: syncWal * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_syncWal( - JNIEnv* env, jobject, jlong jdb_handle) { +void Java_org_rocksdb_RocksDB_syncWal(JNIEnv* env, jobject, jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); auto s = db->SyncWAL(); if (!s.ok()) { @@ -3305,8 +3319,8 @@ void Java_org_rocksdb_RocksDB_syncWal( * Method: getLatestSequenceNumber * Signature: (J)V */ -jlong Java_org_rocksdb_RocksDB_getLatestSequenceNumber( - JNIEnv*, jobject, jlong jdb_handle) { +jlong Java_org_rocksdb_RocksDB_getLatestSequenceNumber(JNIEnv*, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); return db->GetLatestSequenceNumber(); } @@ -3316,8 +3330,8 @@ jlong Java_org_rocksdb_RocksDB_getLatestSequenceNumber( * Method: disableFileDeletions * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_disableFileDeletions( - JNIEnv* env, jobject, jlong jdb_handle) { +void Java_org_rocksdb_RocksDB_disableFileDeletions(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::Status s = db->DisableFileDeletions(); if (!s.ok()) { @@ -3330,8 +3344,9 @@ void Java_org_rocksdb_RocksDB_disableFileDeletions( * Method: enableFileDeletions * Signature: (JZ)V */ -void Java_org_rocksdb_RocksDB_enableFileDeletions( - JNIEnv* env, jobject, jlong jdb_handle, jboolean jforce) { +void Java_org_rocksdb_RocksDB_enableFileDeletions(JNIEnv* env, jobject, + jlong jdb_handle, + jboolean jforce) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::Status s = db->EnableFileDeletions(jforce); if (!s.ok()) { @@ -3344,13 +3359,14 @@ void Java_org_rocksdb_RocksDB_enableFileDeletions( * Method: getLiveFiles * Signature: (JZ)[Ljava/lang/String; */ -jobjectArray Java_org_rocksdb_RocksDB_getLiveFiles( - JNIEnv* env, jobject, jlong jdb_handle, jboolean jflush_memtable) { +jobjectArray Java_org_rocksdb_RocksDB_getLiveFiles(JNIEnv* env, jobject, + jlong jdb_handle, + jboolean jflush_memtable) { auto* db = reinterpret_cast(jdb_handle); std::vector live_files; uint64_t manifest_file_size = 0; - auto s = db->GetLiveFiles( - live_files, &manifest_file_size, jflush_memtable == JNI_TRUE); + auto s = db->GetLiveFiles(live_files, &manifest_file_size, + jflush_memtable == JNI_TRUE); if (!s.ok()) { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; @@ -3368,8 +3384,8 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFiles( * Method: getSortedWalFiles * Signature: (J)[Lorg/rocksdb/LogFile; */ -jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles( - JNIEnv* env, jobject, jlong jdb_handle) { +jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); std::vector> sorted_wal_files; auto s = db->GetSortedWalFiles(sorted_wal_files); @@ -3382,7 +3398,7 @@ jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles( const jsize jlen = static_cast(sorted_wal_files.size()); jobjectArray jsorted_wal_files = env->NewObjectArray( jlen, ROCKSDB_NAMESPACE::LogFileJni::getJClass(env), nullptr); - if(jsorted_wal_files == nullptr) { + if (jsorted_wal_files == nullptr) { // exception thrown: OutOfMemoryError return nullptr; } @@ -3416,8 +3432,9 @@ jobjectArray Java_org_rocksdb_RocksDB_getSortedWalFiles( * Method: getUpdatesSince * Signature: (JJ)J */ -jlong Java_org_rocksdb_RocksDB_getUpdatesSince( - JNIEnv* env, jobject, jlong jdb_handle, jlong jsequence_number) { +jlong Java_org_rocksdb_RocksDB_getUpdatesSince(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jsequence_number) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::SequenceNumber sequence_number = static_cast(jsequence_number); @@ -3436,8 +3453,8 @@ jlong Java_org_rocksdb_RocksDB_getUpdatesSince( * Method: deleteFile * Signature: (JLjava/lang/String;)V */ -void Java_org_rocksdb_RocksDB_deleteFile( - JNIEnv* env, jobject, jlong jdb_handle, jstring jname) { +void Java_org_rocksdb_RocksDB_deleteFile(JNIEnv* env, jobject, jlong jdb_handle, + jstring jname) { auto* db = reinterpret_cast(jdb_handle); jboolean has_exception = JNI_FALSE; std::string name = @@ -3454,8 +3471,8 @@ void Java_org_rocksdb_RocksDB_deleteFile( * Method: getLiveFilesMetaData * Signature: (J)[Lorg/rocksdb/LiveFileMetaData; */ -jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( - JNIEnv* env, jobject, jlong jdb_handle) { +jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); std::vector live_files_meta_data; db->GetLiveFilesMetaData(&live_files_meta_data); @@ -3464,13 +3481,14 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( const jsize jlen = static_cast(live_files_meta_data.size()); jobjectArray jlive_files_meta_data = env->NewObjectArray( jlen, ROCKSDB_NAMESPACE::LiveFileMetaDataJni::getJClass(env), nullptr); - if(jlive_files_meta_data == nullptr) { + if (jlive_files_meta_data == nullptr) { // exception thrown: OutOfMemoryError return nullptr; } jsize i = 0; - for (auto it = live_files_meta_data.begin(); it != live_files_meta_data.end(); ++it) { + for (auto it = live_files_meta_data.begin(); it != live_files_meta_data.end(); + ++it) { jobject jlive_file_meta_data = ROCKSDB_NAMESPACE::LiveFileMetaDataJni::fromCppLiveFileMetaData(env, &(*it)); @@ -3480,7 +3498,8 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( return nullptr; } - env->SetObjectArrayElement(jlive_files_meta_data, i++, jlive_file_meta_data); + env->SetObjectArrayElement(jlive_files_meta_data, i++, + jlive_file_meta_data); if (env->ExceptionCheck()) { // exception occurred env->DeleteLocalRef(jlive_file_meta_data); @@ -3499,8 +3518,9 @@ jobjectArray Java_org_rocksdb_RocksDB_getLiveFilesMetaData( * Method: getColumnFamilyMetaData * Signature: (JJ)Lorg/rocksdb/ColumnFamilyMetaData; */ -jobject Java_org_rocksdb_RocksDB_getColumnFamilyMetaData( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { +jobject Java_org_rocksdb_RocksDB_getColumnFamilyMetaData(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3550,8 +3570,8 @@ void Java_org_rocksdb_RocksDB_ingestExternalFile( * Method: verifyChecksum * Signature: (J)V */ -void Java_org_rocksdb_RocksDB_verifyChecksum( - JNIEnv* env, jobject, jlong jdb_handle) { +void Java_org_rocksdb_RocksDB_verifyChecksum(JNIEnv* env, jobject, + jlong jdb_handle) { auto* db = reinterpret_cast(jdb_handle); auto s = db->VerifyChecksum(); if (!s.ok()) { @@ -3564,8 +3584,8 @@ void Java_org_rocksdb_RocksDB_verifyChecksum( * Method: getDefaultColumnFamily * Signature: (J)J */ -jlong Java_org_rocksdb_RocksDB_getDefaultColumnFamily( - JNIEnv*, jobject, jlong jdb_handle) { +jlong Java_org_rocksdb_RocksDB_getDefaultColumnFamily(JNIEnv*, jobject, + jlong jdb_handle) { auto* db_handle = reinterpret_cast(jdb_handle); auto* cf_handle = db_handle->DefaultColumnFamily(); return GET_CPLUSPLUS_POINTER(cf_handle); @@ -3576,8 +3596,9 @@ jlong Java_org_rocksdb_RocksDB_getDefaultColumnFamily( * Method: getPropertiesOfAllTables * Signature: (JJ)Ljava/util/Map; */ -jobject Java_org_rocksdb_RocksDB_getPropertiesOfAllTables( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { +jobject Java_org_rocksdb_RocksDB_getPropertiesOfAllTables(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3587,8 +3608,8 @@ jobject Java_org_rocksdb_RocksDB_getPropertiesOfAllTables( reinterpret_cast(jcf_handle); } ROCKSDB_NAMESPACE::TablePropertiesCollection table_properties_collection; - auto s = db->GetPropertiesOfAllTables(cf_handle, - &table_properties_collection); + auto s = + db->GetPropertiesOfAllTables(cf_handle, &table_properties_collection); if (!s.ok()) { ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } @@ -3678,17 +3699,19 @@ jobject Java_org_rocksdb_RocksDB_getPropertiesOfTablesInRange( } ROCKSDB_NAMESPACE::TablePropertiesCollection table_properties_collection; - auto s = db->GetPropertiesOfTablesInRange( - cf_handle, ranges.get(), ranges_len, &table_properties_collection); + auto s = db->GetPropertiesOfTablesInRange(cf_handle, ranges.get(), ranges_len, + &table_properties_collection); if (!s.ok()) { // error occurred - env->ReleaseLongArrayElements(jrange_slice_handles, jrange_slice_handle, JNI_ABORT); + env->ReleaseLongArrayElements(jrange_slice_handles, jrange_slice_handle, + JNI_ABORT); ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); return nullptr; } // cleanup - env->ReleaseLongArrayElements(jrange_slice_handles, jrange_slice_handle, JNI_ABORT); + env->ReleaseLongArrayElements(jrange_slice_handles, jrange_slice_handle, + JNI_ABORT); return jrange_slice_handles; } @@ -3698,8 +3721,9 @@ jobject Java_org_rocksdb_RocksDB_getPropertiesOfTablesInRange( * Method: suggestCompactRange * Signature: (JJ)[J */ -jlongArray Java_org_rocksdb_RocksDB_suggestCompactRange( - JNIEnv* env, jobject, jlong jdb_handle, jlong jcf_handle) { +jlongArray Java_org_rocksdb_RocksDB_suggestCompactRange(JNIEnv* env, jobject, + jlong jdb_handle, + jlong jcf_handle) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3747,8 +3771,8 @@ jlongArray Java_org_rocksdb_RocksDB_suggestCompactRange( * Method: promoteL0 * Signature: (JJI)V */ -void Java_org_rocksdb_RocksDB_promoteL0( - JNIEnv*, jobject, jlong jdb_handle, jlong jcf_handle, jint jtarget_level) { +void Java_org_rocksdb_RocksDB_promoteL0(JNIEnv*, jobject, jlong jdb_handle, + jlong jcf_handle, jint jtarget_level) { auto* db = reinterpret_cast(jdb_handle); ROCKSDB_NAMESPACE::ColumnFamilyHandle* cf_handle; if (jcf_handle == 0) { @@ -3815,8 +3839,8 @@ void Java_org_rocksdb_RocksDB_tryCatchUpWithPrimary(JNIEnv* env, jobject, * Method: destroyDB * Signature: (Ljava/lang/String;J)V */ -void Java_org_rocksdb_RocksDB_destroyDB( - JNIEnv* env, jclass, jstring jdb_path, jlong joptions_handle) { +void Java_org_rocksdb_RocksDB_destroyDB(JNIEnv* env, jclass, jstring jdb_path, + jlong joptions_handle) { const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { // exception thrown: OutOfMemoryError diff --git a/java/rocksjni/sst_file_reader_iterator.cc b/java/rocksjni/sst_file_reader_iterator.cc index ac92285b6..68fa4c37c 100644 --- a/java/rocksjni/sst_file_reader_iterator.cc +++ b/java/rocksjni/sst_file_reader_iterator.cc @@ -176,7 +176,8 @@ jbyteArray Java_org_rocksdb_SstFileReaderIterator_key0(JNIEnv* env, * Method: value0 * Signature: (J)[B */ -jbyteArray Java_org_rocksdb_SstFileReaderIterator_value0(JNIEnv* env, jobject /*jobj*/, +jbyteArray Java_org_rocksdb_SstFileReaderIterator_value0(JNIEnv* env, + jobject /*jobj*/, jlong handle) { auto* it = reinterpret_cast(handle); ROCKSDB_NAMESPACE::Slice value_slice = it->value(); @@ -186,10 +187,11 @@ jbyteArray Java_org_rocksdb_SstFileReaderIterator_value0(JNIEnv* env, jobject /* if (jkeyValue == nullptr) { // exception thrown: OutOfMemoryError return nullptr; - } - env->SetByteArrayRegion(jkeyValue, 0, static_cast(value_slice.size()), - const_cast(reinterpret_cast(value_slice.data()))); - return jkeyValue; + } + env->SetByteArrayRegion( + jkeyValue, 0, static_cast(value_slice.size()), + const_cast(reinterpret_cast(value_slice.data()))); + return jkeyValue; } /* @@ -357,8 +359,9 @@ void Java_org_rocksdb_SstFileReaderIterator_seekForPrevByteArray0( * Method: refresh0 * Signature: (J)V */ -void Java_org_rocksdb_SstFileReaderIterator_refresh0(JNIEnv* env, jobject /*jobj*/, - jlong handle) { +void Java_org_rocksdb_SstFileReaderIterator_refresh0(JNIEnv* env, + jobject /*jobj*/, + jlong handle) { auto* it = reinterpret_cast(handle); ROCKSDB_NAMESPACE::Status s = it->Refresh(); diff --git a/java/rocksjni/statistics.cc b/java/rocksjni/statistics.cc index 6672cbdcf..bd405afa1 100644 --- a/java/rocksjni/statistics.cc +++ b/java/rocksjni/statistics.cc @@ -23,10 +23,8 @@ * Method: newStatistics * Signature: ()J */ -jlong Java_org_rocksdb_Statistics_newStatistics__( - JNIEnv* env, jclass jcls) { - return Java_org_rocksdb_Statistics_newStatistics___3BJ( - env, jcls, nullptr, 0); +jlong Java_org_rocksdb_Statistics_newStatistics__(JNIEnv* env, jclass jcls) { + return Java_org_rocksdb_Statistics_newStatistics___3BJ(env, jcls, nullptr, 0); } /* @@ -45,10 +43,10 @@ jlong Java_org_rocksdb_Statistics_newStatistics__J( * Method: newStatistics * Signature: ([B)J */ -jlong Java_org_rocksdb_Statistics_newStatistics___3B( - JNIEnv* env, jclass jcls, jbyteArray jhistograms) { - return Java_org_rocksdb_Statistics_newStatistics___3BJ( - env, jcls, jhistograms, 0); +jlong Java_org_rocksdb_Statistics_newStatistics___3B(JNIEnv* env, jclass jcls, + jbyteArray jhistograms) { + return Java_org_rocksdb_Statistics_newStatistics___3BJ(env, jcls, jhistograms, + 0); } /* @@ -57,7 +55,8 @@ jlong Java_org_rocksdb_Statistics_newStatistics___3B( * Signature: ([BJ)J */ jlong Java_org_rocksdb_Statistics_newStatistics___3BJ( - JNIEnv* env, jclass, jbyteArray jhistograms, jlong jother_statistics_handle) { + JNIEnv* env, jclass, jbyteArray jhistograms, + jlong jother_statistics_handle) { std::shared_ptr* pSptr_other_statistics = nullptr; if (jother_statistics_handle > 0) { @@ -105,8 +104,8 @@ jlong Java_org_rocksdb_Statistics_newStatistics___3BJ( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_Statistics_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_Statistics_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { if (jhandle > 0) { auto* pSptr_statistics = reinterpret_cast*>( @@ -120,8 +119,7 @@ void Java_org_rocksdb_Statistics_disposeInternal( * Method: statsLevel * Signature: (J)B */ -jbyte Java_org_rocksdb_Statistics_statsLevel( - JNIEnv*, jobject, jlong jhandle) { +jbyte Java_org_rocksdb_Statistics_statsLevel(JNIEnv*, jobject, jlong jhandle) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -135,8 +133,8 @@ jbyte Java_org_rocksdb_Statistics_statsLevel( * Method: setStatsLevel * Signature: (JB)V */ -void Java_org_rocksdb_Statistics_setStatsLevel( - JNIEnv*, jobject, jlong jhandle, jbyte jstats_level) { +void Java_org_rocksdb_Statistics_setStatsLevel(JNIEnv*, jobject, jlong jhandle, + jbyte jstats_level) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -151,8 +149,9 @@ void Java_org_rocksdb_Statistics_setStatsLevel( * Method: getTickerCount * Signature: (JB)J */ -jlong Java_org_rocksdb_Statistics_getTickerCount( - JNIEnv*, jobject, jlong jhandle, jbyte jticker_type) { +jlong Java_org_rocksdb_Statistics_getTickerCount(JNIEnv*, jobject, + jlong jhandle, + jbyte jticker_type) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -167,8 +166,9 @@ jlong Java_org_rocksdb_Statistics_getTickerCount( * Method: getAndResetTickerCount * Signature: (JB)J */ -jlong Java_org_rocksdb_Statistics_getAndResetTickerCount( - JNIEnv*, jobject, jlong jhandle, jbyte jticker_type) { +jlong Java_org_rocksdb_Statistics_getAndResetTickerCount(JNIEnv*, jobject, + jlong jhandle, + jbyte jticker_type) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -182,8 +182,9 @@ jlong Java_org_rocksdb_Statistics_getAndResetTickerCount( * Method: getHistogramData * Signature: (JB)Lorg/rocksdb/HistogramData; */ -jobject Java_org_rocksdb_Statistics_getHistogramData( - JNIEnv* env, jobject, jlong jhandle, jbyte jhistogram_type) { +jobject Java_org_rocksdb_Statistics_getHistogramData(JNIEnv* env, jobject, + jlong jhandle, + jbyte jhistogram_type) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -213,8 +214,8 @@ jobject Java_org_rocksdb_Statistics_getHistogramData( return env->NewObject(jclazz, mid, data.median, data.percentile95, data.percentile99, data.average, - data.standard_deviation, data.max, data.count, - data.sum, data.min); + data.standard_deviation, data.max, data.count, data.sum, + data.min); } /* @@ -222,8 +223,9 @@ jobject Java_org_rocksdb_Statistics_getHistogramData( * Method: getHistogramString * Signature: (JB)Ljava/lang/String; */ -jstring Java_org_rocksdb_Statistics_getHistogramString( - JNIEnv* env, jobject, jlong jhandle, jbyte jhistogram_type) { +jstring Java_org_rocksdb_Statistics_getHistogramString(JNIEnv* env, jobject, + jlong jhandle, + jbyte jhistogram_type) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -239,8 +241,7 @@ jstring Java_org_rocksdb_Statistics_getHistogramString( * Method: reset * Signature: (J)V */ -void Java_org_rocksdb_Statistics_reset( - JNIEnv* env, jobject, jlong jhandle) { +void Java_org_rocksdb_Statistics_reset(JNIEnv* env, jobject, jlong jhandle) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); @@ -256,8 +257,8 @@ void Java_org_rocksdb_Statistics_reset( * Method: toString * Signature: (J)Ljava/lang/String; */ -jstring Java_org_rocksdb_Statistics_toString( - JNIEnv* env, jobject, jlong jhandle) { +jstring Java_org_rocksdb_Statistics_toString(JNIEnv* env, jobject, + jlong jhandle) { auto* pSptr_statistics = reinterpret_cast*>( jhandle); diff --git a/java/rocksjni/statisticsjni.h b/java/rocksjni/statisticsjni.h index db3985582..ce823f9b1 100644 --- a/java/rocksjni/statisticsjni.h +++ b/java/rocksjni/statisticsjni.h @@ -12,8 +12,9 @@ #include #include #include -#include "rocksdb/statistics.h" + #include "monitoring/statistics.h" +#include "rocksdb/statistics.h" namespace ROCKSDB_NAMESPACE { @@ -26,8 +27,8 @@ class StatisticsJni : public StatisticsImpl { private: const std::set m_ignore_histograms; - }; +}; - } // namespace ROCKSDB_NAMESPACE +} // namespace ROCKSDB_NAMESPACE #endif // JAVA_ROCKSJNI_STATISTICSJNI_H_ diff --git a/java/rocksjni/table.cc b/java/rocksjni/table.cc index f85905bc6..0054e5c1f 100644 --- a/java/rocksjni/table.cc +++ b/java/rocksjni/table.cc @@ -72,9 +72,9 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( options.cache_index_and_filter_blocks_with_high_priority = static_cast(jcache_index_and_filter_blocks_with_high_priority); options.pin_l0_filter_and_index_blocks_in_cache = - static_cast(jpin_l0_filter_and_index_blocks_in_cache); + static_cast(jpin_l0_filter_and_index_blocks_in_cache); options.pin_top_level_index_and_filter = - static_cast(jpin_top_level_index_and_filter); + static_cast(jpin_top_level_index_and_filter); options.index_type = ROCKSDB_NAMESPACE::IndexTypeJni::toCppIndexType(jindex_type_value); options.data_block_index_type = @@ -131,7 +131,8 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( options.block_size = static_cast(jblock_size); options.block_size_deviation = static_cast(jblock_size_deviation); options.block_restart_interval = static_cast(jblock_restart_interval); - options.index_block_restart_interval = static_cast(jindex_block_restart_interval); + options.index_block_restart_interval = + static_cast(jindex_block_restart_interval); options.metadata_block_size = static_cast(jmetadata_block_size); options.partition_filters = static_cast(jpartition_filters); options.optimize_filters_for_memory = @@ -145,9 +146,11 @@ jlong Java_org_rocksdb_BlockBasedTableConfig_newTableFactoryHandle( } options.whole_key_filtering = static_cast(jwhole_key_filtering); options.verify_compression = static_cast(jverify_compression); - options.read_amp_bytes_per_bit = static_cast(jread_amp_bytes_per_bit); + options.read_amp_bytes_per_bit = + static_cast(jread_amp_bytes_per_bit); options.format_version = static_cast(jformat_version); - options.enable_index_compression = static_cast(jenable_index_compression); + options.enable_index_compression = + static_cast(jenable_index_compression); options.block_align = static_cast(jblock_align); options.index_shortening = ROCKSDB_NAMESPACE::IndexShorteningModeJni::toCppIndexShorteningMode( diff --git a/java/rocksjni/table_filter_jnicallback.cc b/java/rocksjni/table_filter_jnicallback.cc index d1699548d..5350c5cee 100644 --- a/java/rocksjni/table_filter_jnicallback.cc +++ b/java/rocksjni/table_filter_jnicallback.cc @@ -7,15 +7,15 @@ // ROCKSDB_NAMESPACE::TableFilter. #include "rocksjni/table_filter_jnicallback.h" + #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { -TableFilterJniCallback::TableFilterJniCallback( - JNIEnv* env, jobject jtable_filter) +TableFilterJniCallback::TableFilterJniCallback(JNIEnv* env, + jobject jtable_filter) : JniCallback(env, jtable_filter) { - m_jfilter_methodid = - AbstractTableFilterJni::getFilterMethod(env); - if(m_jfilter_methodid == nullptr) { + m_jfilter_methodid = AbstractTableFilterJni::getFilterMethod(env); + if (m_jfilter_methodid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } diff --git a/java/rocksjni/table_filter_jnicallback.h b/java/rocksjni/table_filter_jnicallback.h index b5804737a..0ef404ca2 100644 --- a/java/rocksjni/table_filter_jnicallback.h +++ b/java/rocksjni/table_filter_jnicallback.h @@ -10,6 +10,7 @@ #define JAVA_ROCKSJNI_TABLE_FILTER_JNICALLBACK_H_ #include + #include #include @@ -20,15 +21,14 @@ namespace ROCKSDB_NAMESPACE { class TableFilterJniCallback : public JniCallback { public: - TableFilterJniCallback( - JNIEnv* env, jobject jtable_filter); - std::function - GetTableFilterFunction(); - - private: - jmethodID m_jfilter_methodid; - std::function - m_table_filter_function; + TableFilterJniCallback(JNIEnv* env, jobject jtable_filter); + std::function + GetTableFilterFunction(); + + private: + jmethodID m_jfilter_methodid; + std::function + m_table_filter_function; }; } // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/thread_status.cc b/java/rocksjni/thread_status.cc index a5811ec17..c600f6cd5 100644 --- a/java/rocksjni/thread_status.cc +++ b/java/rocksjni/thread_status.cc @@ -6,11 +6,12 @@ // This file implements the "bridge" between Java and C++ and enables // calling c++ ROCKSDB_NAMESPACE::ThreadStatus methods from Java side. +#include "rocksdb/thread_status.h" + #include -#include "portal.h" #include "include/org_rocksdb_ThreadStatus.h" -#include "rocksdb/thread_status.h" +#include "portal.h" /* * Class: org_rocksdb_ThreadStatus @@ -42,8 +43,8 @@ jstring Java_org_rocksdb_ThreadStatus_getOperationName( * Method: microsToStringNative * Signature: (J)Ljava/lang/String; */ -jstring Java_org_rocksdb_ThreadStatus_microsToStringNative( - JNIEnv* env, jclass, jlong jmicros) { +jstring Java_org_rocksdb_ThreadStatus_microsToStringNative(JNIEnv* env, jclass, + jlong jmicros) { auto str = ROCKSDB_NAMESPACE::ThreadStatus::MicrosToString( static_cast(jmicros)); return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &str, true); @@ -84,8 +85,7 @@ jstring Java_org_rocksdb_ThreadStatus_getOperationPropertyName( jobject Java_org_rocksdb_ThreadStatus_interpretOperationProperties( JNIEnv* env, jclass, jbyte joperation_type_value, jlongArray joperation_properties) { - - //convert joperation_properties + // convert joperation_properties const jsize len = env->GetArrayLength(joperation_properties); const std::unique_ptr op_properties(new uint64_t[len]); jlong* jop = env->GetLongArrayElements(joperation_properties, nullptr); @@ -117,8 +117,8 @@ jobject Java_org_rocksdb_ThreadStatus_interpretOperationProperties( * Method: getStateName * Signature: (B)Ljava/lang/String; */ -jstring Java_org_rocksdb_ThreadStatus_getStateName( - JNIEnv* env, jclass, jbyte jstate_type_value) { +jstring Java_org_rocksdb_ThreadStatus_getStateName(JNIEnv* env, jclass, + jbyte jstate_type_value) { auto name = ROCKSDB_NAMESPACE::ThreadStatus::GetStateName( ROCKSDB_NAMESPACE::StateTypeJni::toCppStateType(jstate_type_value)); return ROCKSDB_NAMESPACE::JniUtil::toJavaString(env, &name, true); diff --git a/java/rocksjni/trace_writer.cc b/java/rocksjni/trace_writer.cc index 0fc3afd99..d58276399 100644 --- a/java/rocksjni/trace_writer.cc +++ b/java/rocksjni/trace_writer.cc @@ -17,8 +17,8 @@ * Method: createNewTraceWriter * Signature: ()J */ -jlong Java_org_rocksdb_AbstractTraceWriter_createNewTraceWriter( - JNIEnv* env, jobject jobj) { +jlong Java_org_rocksdb_AbstractTraceWriter_createNewTraceWriter(JNIEnv* env, + jobject jobj) { auto* trace_writer = new ROCKSDB_NAMESPACE::TraceWriterJniCallback(env, jobj); return GET_CPLUSPLUS_POINTER(trace_writer); } diff --git a/java/rocksjni/trace_writer_jnicallback.cc b/java/rocksjni/trace_writer_jnicallback.cc index b6566d335..d1ed32038 100644 --- a/java/rocksjni/trace_writer_jnicallback.cc +++ b/java/rocksjni/trace_writer_jnicallback.cc @@ -7,29 +7,29 @@ // ROCKSDB_NAMESPACE::TraceWriter. #include "rocksjni/trace_writer_jnicallback.h" + #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { -TraceWriterJniCallback::TraceWriterJniCallback( - JNIEnv* env, jobject jtrace_writer) +TraceWriterJniCallback::TraceWriterJniCallback(JNIEnv* env, + jobject jtrace_writer) : JniCallback(env, jtrace_writer) { - m_jwrite_proxy_methodid = - AbstractTraceWriterJni::getWriteProxyMethodId(env); - if(m_jwrite_proxy_methodid == nullptr) { + m_jwrite_proxy_methodid = AbstractTraceWriterJni::getWriteProxyMethodId(env); + if (m_jwrite_proxy_methodid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } m_jclose_writer_proxy_methodid = AbstractTraceWriterJni::getCloseWriterProxyMethodId(env); - if(m_jclose_writer_proxy_methodid == nullptr) { + if (m_jclose_writer_proxy_methodid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } m_jget_file_size_methodid = AbstractTraceWriterJni::getGetFileSizeMethodId(env); - if(m_jget_file_size_methodid == nullptr) { + if (m_jget_file_size_methodid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } @@ -42,21 +42,22 @@ Status TraceWriterJniCallback::Write(const Slice& data) { return Status::IOError("Unable to attach JNI Environment"); } - jshort jstatus = env->CallShortMethod(m_jcallback_obj, - m_jwrite_proxy_methodid, - &data); + jshort jstatus = + env->CallShortMethod(m_jcallback_obj, m_jwrite_proxy_methodid, &data); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown from CallShortMethod env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); - return Status::IOError("Unable to call AbstractTraceWriter#writeProxy(long)"); + return Status::IOError( + "Unable to call AbstractTraceWriter#writeProxy(long)"); } // unpack status code and status sub-code from jstatus jbyte jcode_value = (jstatus >> 8) & 0xFF; jbyte jsub_code_value = jstatus & 0xFF; - std::unique_ptr s = StatusJni::toCppStatus(jcode_value, jsub_code_value); + std::unique_ptr s = + StatusJni::toCppStatus(jcode_value, jsub_code_value); releaseJniEnv(attached_thread); @@ -70,20 +71,22 @@ Status TraceWriterJniCallback::Close() { return Status::IOError("Unable to attach JNI Environment"); } - jshort jstatus = env->CallShortMethod(m_jcallback_obj, - m_jclose_writer_proxy_methodid); + jshort jstatus = + env->CallShortMethod(m_jcallback_obj, m_jclose_writer_proxy_methodid); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown from CallShortMethod env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); - return Status::IOError("Unable to call AbstractTraceWriter#closeWriterProxy()"); + return Status::IOError( + "Unable to call AbstractTraceWriter#closeWriterProxy()"); } // unpack status code and status sub-code from jstatus jbyte code_value = (jstatus >> 8) & 0xFF; jbyte sub_code_value = jstatus & 0xFF; - std::unique_ptr s = StatusJni::toCppStatus(code_value, sub_code_value); + std::unique_ptr s = + StatusJni::toCppStatus(code_value, sub_code_value); releaseJniEnv(attached_thread); @@ -97,10 +100,10 @@ uint64_t TraceWriterJniCallback::GetFileSize() { return 0; } - jlong jfile_size = env->CallLongMethod(m_jcallback_obj, - m_jget_file_size_methodid); + jlong jfile_size = + env->CallLongMethod(m_jcallback_obj, m_jget_file_size_methodid); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown from CallLongMethod env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); diff --git a/java/rocksjni/trace_writer_jnicallback.h b/java/rocksjni/trace_writer_jnicallback.h index eb2a8b0f8..c82a3a72c 100644 --- a/java/rocksjni/trace_writer_jnicallback.h +++ b/java/rocksjni/trace_writer_jnicallback.h @@ -10,6 +10,7 @@ #define JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_ #include + #include #include "rocksdb/trace_reader_writer.h" @@ -19,16 +20,15 @@ namespace ROCKSDB_NAMESPACE { class TraceWriterJniCallback : public JniCallback, public TraceWriter { public: - TraceWriterJniCallback( - JNIEnv* env, jobject jtrace_writer); - virtual Status Write(const Slice& data); - virtual Status Close(); - virtual uint64_t GetFileSize(); + TraceWriterJniCallback(JNIEnv* env, jobject jtrace_writer); + virtual Status Write(const Slice& data); + virtual Status Close(); + virtual uint64_t GetFileSize(); private: - jmethodID m_jwrite_proxy_methodid; - jmethodID m_jclose_writer_proxy_methodid; - jmethodID m_jget_file_size_methodid; + jmethodID m_jwrite_proxy_methodid; + jmethodID m_jclose_writer_proxy_methodid; + jmethodID m_jget_file_size_methodid; }; } // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/transaction.cc b/java/rocksjni/transaction.cc index 5c01436f1..319625b1f 100644 --- a/java/rocksjni/transaction.cc +++ b/java/rocksjni/transaction.cc @@ -190,8 +190,9 @@ jbyteArray txn_get_helper(JNIEnv* env, const FnGet& fn_get, // exception thrown: OutOfMemoryError return nullptr; } - env->SetByteArrayRegion(jret_value, 0, static_cast(value.size()), - const_cast(reinterpret_cast(value.c_str()))); + env->SetByteArrayRegion( + jret_value, 0, static_cast(value.size()), + const_cast(reinterpret_cast(value.c_str()))); if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException return nullptr; @@ -366,7 +367,8 @@ jobjectArray txn_multi_get_helper(JNIEnv* env, const FnMultiGet& fn_multi_get, env->SetByteArrayRegion( jentry_value, 0, static_cast(value_parts[i].size()), - const_cast(reinterpret_cast(value_parts[i].c_str()))); + const_cast( + reinterpret_cast(value_parts[i].c_str()))); if (env->ExceptionCheck()) { // exception thrown: ArrayIndexOutOfBoundsException env->DeleteLocalRef(jentry_value); @@ -647,7 +649,7 @@ void txn_write_kv_parts_helper(JNIEnv* env, const jobjectArray& jvalue_parts, const jint& jvalue_parts_len) { #ifndef DEBUG - (void) jvalue_parts_len; + (void)jvalue_parts_len; #else assert(jkey_parts_len == jvalue_parts_len); #endif diff --git a/java/rocksjni/transaction_db.cc b/java/rocksjni/transaction_db.cc index 2066d6d7e..9d83e3b6b 100644 --- a/java/rocksjni/transaction_db.cc +++ b/java/rocksjni/transaction_db.cc @@ -26,8 +26,8 @@ * Signature: (JJLjava/lang/String;)J */ jlong Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2( - JNIEnv* env, jclass, jlong joptions_handle, - jlong jtxn_db_options_handle, jstring jdb_path) { + JNIEnv* env, jclass, jlong joptions_handle, jlong jtxn_db_options_handle, + jstring jdb_path) { auto* options = reinterpret_cast(joptions_handle); auto* txn_db_options = @@ -57,8 +57,8 @@ jlong Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2( * Signature: (JJLjava/lang/String;[[B[J)[J */ jlongArray Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2_3_3B_3J( - JNIEnv* env, jclass, jlong jdb_options_handle, - jlong jtxn_db_options_handle, jstring jdb_path, jobjectArray jcolumn_names, + JNIEnv* env, jclass, jlong jdb_options_handle, jlong jtxn_db_options_handle, + jstring jdb_path, jobjectArray jcolumn_names, jlongArray jcolumn_options_handles) { const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { @@ -161,8 +161,8 @@ jlongArray Java_org_rocksdb_TransactionDB_open__JJLjava_lang_String_2_3_3B_3J( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_TransactionDB_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_TransactionDB_disposeInternal(JNIEnv*, jobject, + jlong jhandle) { auto* txn_db = reinterpret_cast(jhandle); assert(txn_db != nullptr); delete txn_db; @@ -173,8 +173,8 @@ void Java_org_rocksdb_TransactionDB_disposeInternal( * Method: closeDatabase * Signature: (J)V */ -void Java_org_rocksdb_TransactionDB_closeDatabase( - JNIEnv* env, jclass, jlong jhandle) { +void Java_org_rocksdb_TransactionDB_closeDatabase(JNIEnv* env, jclass, + jlong jhandle) { auto* txn_db = reinterpret_cast(jhandle); assert(txn_db != nullptr); ROCKSDB_NAMESPACE::Status s = txn_db->Close(); @@ -270,8 +270,9 @@ jlong Java_org_rocksdb_TransactionDB_beginTransaction_1withOld__JJJJ( * Method: getTransactionByName * Signature: (JLjava/lang/String;)J */ -jlong Java_org_rocksdb_TransactionDB_getTransactionByName( - JNIEnv* env, jobject, jlong jhandle, jstring jname) { +jlong Java_org_rocksdb_TransactionDB_getTransactionByName(JNIEnv* env, jobject, + jlong jhandle, + jstring jname) { auto* txn_db = reinterpret_cast(jhandle); const char* name = env->GetStringUTFChars(jname, nullptr); if (name == nullptr) { @@ -323,8 +324,8 @@ jlongArray Java_org_rocksdb_TransactionDB_getAllPreparedTransactions( * Method: getLockStatusData * Signature: (J)Ljava/util/Map; */ -jobject Java_org_rocksdb_TransactionDB_getLockStatusData( - JNIEnv* env, jobject, jlong jhandle) { +jobject Java_org_rocksdb_TransactionDB_getLockStatusData(JNIEnv* env, jobject, + jlong jhandle) { auto* txn_db = reinterpret_cast(jhandle); const std::unordered_multimap lock_status_data = txn_db->GetLockStatusData(); diff --git a/java/rocksjni/transaction_log.cc b/java/rocksjni/transaction_log.cc index aa57211eb..97c3bb301 100644 --- a/java/rocksjni/transaction_log.cc +++ b/java/rocksjni/transaction_log.cc @@ -6,12 +6,13 @@ // This file implements the "bridge" between Java and C++ and enables // calling c++ ROCKSDB_NAMESPACE::Iterator methods from Java side. +#include "rocksdb/transaction_log.h" + #include #include #include #include "include/org_rocksdb_TransactionLogIterator.h" -#include "rocksdb/transaction_log.h" #include "rocksjni/portal.h" /* diff --git a/java/rocksjni/transaction_notifier_jnicallback.cc b/java/rocksjni/transaction_notifier_jnicallback.cc index cd77c60ae..26761cabd 100644 --- a/java/rocksjni/transaction_notifier_jnicallback.cc +++ b/java/rocksjni/transaction_notifier_jnicallback.cc @@ -13,8 +13,9 @@ namespace ROCKSDB_NAMESPACE { -TransactionNotifierJniCallback::TransactionNotifierJniCallback(JNIEnv* env, - jobject jtransaction_notifier) : JniCallback(env, jtransaction_notifier) { +TransactionNotifierJniCallback::TransactionNotifierJniCallback( + JNIEnv* env, jobject jtransaction_notifier) + : JniCallback(env, jtransaction_notifier) { // we cache the method id for the JNI callback m_jsnapshot_created_methodID = AbstractTransactionNotifierJni::getSnapshotCreatedMethodId(env); @@ -29,7 +30,7 @@ void TransactionNotifierJniCallback::SnapshotCreated( env->CallVoidMethod(m_jcallback_obj, m_jsnapshot_created_methodID, GET_CPLUSPLUS_POINTER(newSnapshot)); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown from CallVoidMethod env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); diff --git a/java/rocksjni/transaction_notifier_jnicallback.h b/java/rocksjni/transaction_notifier_jnicallback.h index b3155b5a3..089a5ee4a 100644 --- a/java/rocksjni/transaction_notifier_jnicallback.h +++ b/java/rocksjni/transaction_notifier_jnicallback.h @@ -28,8 +28,8 @@ namespace ROCKSDB_NAMESPACE { * presented to the callback. This could be revisited in future * if performance is lacking. */ -class TransactionNotifierJniCallback: public JniCallback, - public TransactionNotifier { +class TransactionNotifierJniCallback : public JniCallback, + public TransactionNotifier { public: TransactionNotifierJniCallback(JNIEnv* env, jobject jtransaction_notifier); virtual void SnapshotCreated(const Snapshot* newSnapshot); diff --git a/java/rocksjni/ttl.cc b/java/rocksjni/ttl.cc index 1b51954cf..1fe2083d9 100644 --- a/java/rocksjni/ttl.cc +++ b/java/rocksjni/ttl.cc @@ -25,9 +25,9 @@ * Method: open * Signature: (JLjava/lang/String;IZ)J */ -jlong Java_org_rocksdb_TtlDB_open( - JNIEnv* env, jclass, jlong joptions_handle, jstring jdb_path, jint jttl, - jboolean jread_only) { +jlong Java_org_rocksdb_TtlDB_open(JNIEnv* env, jclass, jlong joptions_handle, + jstring jdb_path, jint jttl, + jboolean jread_only) { const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { // exception thrown: OutOfMemoryError @@ -55,10 +55,11 @@ jlong Java_org_rocksdb_TtlDB_open( * Method: openCF * Signature: (JLjava/lang/String;[[B[J[IZ)[J */ -jlongArray Java_org_rocksdb_TtlDB_openCF( - JNIEnv* env, jclass, jlong jopt_handle, jstring jdb_path, - jobjectArray jcolumn_names, jlongArray jcolumn_options, - jintArray jttls, jboolean jread_only) { +jlongArray Java_org_rocksdb_TtlDB_openCF(JNIEnv* env, jclass, jlong jopt_handle, + jstring jdb_path, + jobjectArray jcolumn_names, + jlongArray jcolumn_options, + jintArray jttls, jboolean jread_only) { const char* db_path = env->GetStringUTFChars(jdb_path, nullptr); if (db_path == nullptr) { // exception thrown: OutOfMemoryError @@ -153,8 +154,7 @@ jlongArray Java_org_rocksdb_TtlDB_openCF( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_TtlDB_disposeInternal( - JNIEnv*, jobject, jlong jhandle) { +void Java_org_rocksdb_TtlDB_disposeInternal(JNIEnv*, jobject, jlong jhandle) { auto* ttl_db = reinterpret_cast(jhandle); assert(ttl_db != nullptr); delete ttl_db; @@ -165,14 +165,15 @@ void Java_org_rocksdb_TtlDB_disposeInternal( * Method: closeDatabase * Signature: (J)V */ -void Java_org_rocksdb_TtlDB_closeDatabase( - JNIEnv* /* env */, jclass, jlong /* jhandle */) { +void Java_org_rocksdb_TtlDB_closeDatabase(JNIEnv* /* env */, jclass, + jlong /* jhandle */) { // auto* ttl_db = reinterpret_cast(jhandle); // assert(ttl_db != nullptr); // ROCKSDB_NAMESPACE::Status s = ttl_db->Close(); // ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); - //TODO(AR) this is disabled until https://github.com/facebook/rocksdb/issues/4818 is resolved! + // TODO(AR) this is disabled until + // https://github.com/facebook/rocksdb/issues/4818 is resolved! } /* @@ -180,9 +181,11 @@ void Java_org_rocksdb_TtlDB_closeDatabase( * Method: createColumnFamilyWithTtl * Signature: (JLorg/rocksdb/ColumnFamilyDescriptor;[BJI)J; */ -jlong Java_org_rocksdb_TtlDB_createColumnFamilyWithTtl( - JNIEnv* env, jobject, jlong jdb_handle, jbyteArray jcolumn_name, - jlong jcolumn_options, jint jttl) { +jlong Java_org_rocksdb_TtlDB_createColumnFamilyWithTtl(JNIEnv* env, jobject, + jlong jdb_handle, + jbyteArray jcolumn_name, + jlong jcolumn_options, + jint jttl) { jbyte* cfname = env->GetByteArrayElements(jcolumn_name, nullptr); if (cfname == nullptr) { // exception thrown: OutOfMemoryError diff --git a/java/rocksjni/wal_filter.cc b/java/rocksjni/wal_filter.cc index 5d9ef32fb..24b88afed 100644 --- a/java/rocksjni/wal_filter.cc +++ b/java/rocksjni/wal_filter.cc @@ -17,8 +17,8 @@ * Method: createNewWalFilter * Signature: ()J */ -jlong Java_org_rocksdb_AbstractWalFilter_createNewWalFilter( - JNIEnv* env, jobject jobj) { +jlong Java_org_rocksdb_AbstractWalFilter_createNewWalFilter(JNIEnv* env, + jobject jobj) { auto* wal_filter = new ROCKSDB_NAMESPACE::WalFilterJniCallback(env, jobj); return GET_CPLUSPLUS_POINTER(wal_filter); } diff --git a/java/rocksjni/wal_filter_jnicallback.cc b/java/rocksjni/wal_filter_jnicallback.cc index 656cc592e..d2e3c9076 100644 --- a/java/rocksjni/wal_filter_jnicallback.cc +++ b/java/rocksjni/wal_filter_jnicallback.cc @@ -12,24 +12,23 @@ #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { -WalFilterJniCallback::WalFilterJniCallback( - JNIEnv* env, jobject jwal_filter) +WalFilterJniCallback::WalFilterJniCallback(JNIEnv* env, jobject jwal_filter) : JniCallback(env, jwal_filter) { // Note: The name of a WalFilter will not change during it's lifetime, // so we cache it in a global var jmethodID jname_mid = AbstractWalFilterJni::getNameMethodId(env); - if(jname_mid == nullptr) { + if (jname_mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } jstring jname = (jstring)env->CallObjectMethod(m_jcallback_obj, jname_mid); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown return; } jboolean has_exception = JNI_FALSE; m_name = JniUtil::copyString(env, jname, - &has_exception); // also releases jname + &has_exception); // also releases jname if (has_exception == JNI_TRUE) { // exception thrown return; @@ -37,14 +36,14 @@ WalFilterJniCallback::WalFilterJniCallback( m_column_family_log_number_map_mid = AbstractWalFilterJni::getColumnFamilyLogNumberMapMethodId(env); - if(m_column_family_log_number_map_mid == nullptr) { + if (m_column_family_log_number_map_mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } m_log_record_found_proxy_mid = AbstractWalFilterJni::getLogRecordFoundProxyMethodId(env); - if(m_log_record_found_proxy_mid == nullptr) { + if (m_log_record_found_proxy_mid == nullptr) { // exception thrown: NoSuchMethodException or OutOfMemoryError return; } @@ -63,7 +62,7 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, &cf_lognumber_map); if (jcf_lognumber_map == nullptr) { // exception occurred - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); return; } @@ -72,21 +71,19 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( ROCKSDB_NAMESPACE::HashMapJni::fromCppMap(env, &cf_name_id_map); if (jcf_name_id_map == nullptr) { // exception occurred - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr env->DeleteLocalRef(jcf_lognumber_map); releaseJniEnv(attached_thread); return; } - env->CallVoidMethod(m_jcallback_obj, - m_column_family_log_number_map_mid, - jcf_lognumber_map, - jcf_name_id_map); + env->CallVoidMethod(m_jcallback_obj, m_column_family_log_number_map_mid, + jcf_lognumber_map, jcf_name_id_map); env->DeleteLocalRef(jcf_lognumber_map); env->DeleteLocalRef(jcf_name_id_map); - if(env->ExceptionCheck()) { + if (env->ExceptionCheck()) { // exception thrown from CallVoidMethod env->ExceptionDescribe(); // print out exception to stderr } @@ -94,21 +91,21 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( releaseJniEnv(attached_thread); } - WalFilter::WalProcessingOption WalFilterJniCallback::LogRecordFound( +WalFilter::WalProcessingOption WalFilterJniCallback::LogRecordFound( unsigned long long log_number, const std::string& log_file_name, const WriteBatch& batch, WriteBatch* new_batch, bool* batch_changed) { jboolean attached_thread = JNI_FALSE; JNIEnv* env = getJniEnv(&attached_thread); if (env == nullptr) { - return WalFilter::WalProcessingOption::kCorruptedRecord; + return WalFilter::WalProcessingOption::kCorruptedRecord; } - + jstring jlog_file_name = JniUtil::toJavaString(env, &log_file_name); if (jlog_file_name == nullptr) { // exception occcurred - env->ExceptionDescribe(); // print out exception to stderr + env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); - return WalFilter::WalProcessingOption::kCorruptedRecord; + return WalFilter::WalProcessingOption::kCorruptedRecord; } jshort jlog_record_found_result = env->CallShortMethod( @@ -122,7 +119,7 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( // exception thrown from CallShortMethod env->ExceptionDescribe(); // print out exception to stderr releaseJniEnv(attached_thread); - return WalFilter::WalProcessingOption::kCorruptedRecord; + return WalFilter::WalProcessingOption::kCorruptedRecord; } // unpack WalProcessingOption and batch_changed from jlog_record_found_result @@ -137,8 +134,6 @@ void WalFilterJniCallback::ColumnFamilyLogNumberMap( jwal_processing_option_value); } -const char* WalFilterJniCallback::Name() const { - return m_name.get(); -} +const char* WalFilterJniCallback::Name() const { return m_name.get(); } } // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/wal_filter_jnicallback.h b/java/rocksjni/wal_filter_jnicallback.h index b575ddc62..5cdc65978 100644 --- a/java/rocksjni/wal_filter_jnicallback.h +++ b/java/rocksjni/wal_filter_jnicallback.h @@ -10,6 +10,7 @@ #define JAVA_ROCKSJNI_WAL_FILTER_JNICALLBACK_H_ #include + #include #include #include @@ -21,20 +22,19 @@ namespace ROCKSDB_NAMESPACE { class WalFilterJniCallback : public JniCallback, public WalFilter { public: - WalFilterJniCallback( - JNIEnv* env, jobject jwal_filter); - virtual void ColumnFamilyLogNumberMap( - const std::map& cf_lognumber_map, - const std::map& cf_name_id_map); - virtual WalFilter::WalProcessingOption LogRecordFound( - unsigned long long log_number, const std::string& log_file_name, - const WriteBatch& batch, WriteBatch* new_batch, bool* batch_changed); - virtual const char* Name() const; + WalFilterJniCallback(JNIEnv* env, jobject jwal_filter); + virtual void ColumnFamilyLogNumberMap( + const std::map& cf_lognumber_map, + const std::map& cf_name_id_map); + virtual WalFilter::WalProcessingOption LogRecordFound( + unsigned long long log_number, const std::string& log_file_name, + const WriteBatch& batch, WriteBatch* new_batch, bool* batch_changed); + virtual const char* Name() const; private: - std::unique_ptr m_name; - jmethodID m_column_family_log_number_map_mid; - jmethodID m_log_record_found_proxy_mid; + std::unique_ptr m_name; + jmethodID m_column_family_log_number_map_mid; + jmethodID m_log_record_found_proxy_mid; }; } // namespace ROCKSDB_NAMESPACE diff --git a/java/rocksjni/write_batch_test.cc b/java/rocksjni/write_batch_test.cc index 940429417..30b9a7229 100644 --- a/java/rocksjni/write_batch_test.cc +++ b/java/rocksjni/write_batch_test.cc @@ -5,6 +5,8 @@ // // This file implements the "bridge" between Java and C++ and enables // calling c++ ROCKSDB_NAMESPACE::WriteBatch methods testing from Java side. +#include "rocksdb/write_batch.h" + #include #include "db/memtable.h" @@ -18,7 +20,6 @@ #include "rocksdb/env.h" #include "rocksdb/memtablerep.h" #include "rocksdb/status.h" -#include "rocksdb/write_batch.h" #include "rocksdb/write_buffer_manager.h" #include "rocksjni/portal.h" #include "table/scoped_arena_iterator.h" diff --git a/java/rocksjni/write_batch_with_index.cc b/java/rocksjni/write_batch_with_index.cc index b02ddb672..a5c3216cb 100644 --- a/java/rocksjni/write_batch_with_index.cc +++ b/java/rocksjni/write_batch_with_index.cc @@ -947,6 +947,7 @@ jlongArray Java_org_rocksdb_WBWIRocksIterator_entry1(JNIEnv* env, * Signature: (J)V */ void Java_org_rocksdb_WBWIRocksIterator_refresh0(JNIEnv* env) { - ROCKSDB_NAMESPACE::Status s = ROCKSDB_NAMESPACE::Status::NotSupported("Refresh() is not supported"); + ROCKSDB_NAMESPACE::Status s = + ROCKSDB_NAMESPACE::Status::NotSupported("Refresh() is not supported"); ROCKSDB_NAMESPACE::RocksDBExceptionJni::ThrowNew(env, s); } diff --git a/java/rocksjni/write_buffer_manager.cc b/java/rocksjni/write_buffer_manager.cc index 85a810615..b5b7d193b 100644 --- a/java/rocksjni/write_buffer_manager.cc +++ b/java/rocksjni/write_buffer_manager.cc @@ -34,8 +34,9 @@ jlong Java_org_rocksdb_WriteBufferManager_newWriteBufferManager( * Method: disposeInternal * Signature: (J)V */ -void Java_org_rocksdb_WriteBufferManager_disposeInternal( - JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { +void Java_org_rocksdb_WriteBufferManager_disposeInternal(JNIEnv* /*env*/, + jobject /*jobj*/, + jlong jhandle) { auto* write_buffer_manager = reinterpret_cast*>( jhandle); diff --git a/java/rocksjni/writebatchhandlerjnicallback.cc b/java/rocksjni/writebatchhandlerjnicallback.cc index b9f42f904..66ceabe9a 100644 --- a/java/rocksjni/writebatchhandlerjnicallback.cc +++ b/java/rocksjni/writebatchhandlerjnicallback.cc @@ -7,58 +7,58 @@ // ROCKSDB_NAMESPACE::Comparator. #include "rocksjni/writebatchhandlerjnicallback.h" + #include "rocksjni/portal.h" namespace ROCKSDB_NAMESPACE { WriteBatchHandlerJniCallback::WriteBatchHandlerJniCallback( JNIEnv* env, jobject jWriteBatchHandler) : JniCallback(env, jWriteBatchHandler), m_env(env) { - m_jPutCfMethodId = WriteBatchHandlerJni::getPutCfMethodId(env); - if(m_jPutCfMethodId == nullptr) { + if (m_jPutCfMethodId == nullptr) { // exception thrown return; } m_jPutMethodId = WriteBatchHandlerJni::getPutMethodId(env); - if(m_jPutMethodId == nullptr) { + if (m_jPutMethodId == nullptr) { // exception thrown return; } m_jMergeCfMethodId = WriteBatchHandlerJni::getMergeCfMethodId(env); - if(m_jMergeCfMethodId == nullptr) { + if (m_jMergeCfMethodId == nullptr) { // exception thrown return; } m_jMergeMethodId = WriteBatchHandlerJni::getMergeMethodId(env); - if(m_jMergeMethodId == nullptr) { + if (m_jMergeMethodId == nullptr) { // exception thrown return; } m_jDeleteCfMethodId = WriteBatchHandlerJni::getDeleteCfMethodId(env); - if(m_jDeleteCfMethodId == nullptr) { + if (m_jDeleteCfMethodId == nullptr) { // exception thrown return; } m_jDeleteMethodId = WriteBatchHandlerJni::getDeleteMethodId(env); - if(m_jDeleteMethodId == nullptr) { + if (m_jDeleteMethodId == nullptr) { // exception thrown return; } m_jSingleDeleteCfMethodId = WriteBatchHandlerJni::getSingleDeleteCfMethodId(env); - if(m_jSingleDeleteCfMethodId == nullptr) { + if (m_jSingleDeleteCfMethodId == nullptr) { // exception thrown return; } m_jSingleDeleteMethodId = WriteBatchHandlerJni::getSingleDeleteMethodId(env); - if(m_jSingleDeleteMethodId == nullptr) { + if (m_jSingleDeleteMethodId == nullptr) { // exception thrown return; } @@ -77,46 +77,46 @@ WriteBatchHandlerJniCallback::WriteBatchHandlerJniCallback( } m_jLogDataMethodId = WriteBatchHandlerJni::getLogDataMethodId(env); - if(m_jLogDataMethodId == nullptr) { + if (m_jLogDataMethodId == nullptr) { // exception thrown return; } m_jPutBlobIndexCfMethodId = WriteBatchHandlerJni::getPutBlobIndexCfMethodId(env); - if(m_jPutBlobIndexCfMethodId == nullptr) { + if (m_jPutBlobIndexCfMethodId == nullptr) { // exception thrown return; } m_jMarkBeginPrepareMethodId = WriteBatchHandlerJni::getMarkBeginPrepareMethodId(env); - if(m_jMarkBeginPrepareMethodId == nullptr) { + if (m_jMarkBeginPrepareMethodId == nullptr) { // exception thrown return; } m_jMarkEndPrepareMethodId = WriteBatchHandlerJni::getMarkEndPrepareMethodId(env); - if(m_jMarkEndPrepareMethodId == nullptr) { + if (m_jMarkEndPrepareMethodId == nullptr) { // exception thrown return; } m_jMarkNoopMethodId = WriteBatchHandlerJni::getMarkNoopMethodId(env); - if(m_jMarkNoopMethodId == nullptr) { + if (m_jMarkNoopMethodId == nullptr) { // exception thrown return; } m_jMarkRollbackMethodId = WriteBatchHandlerJni::getMarkRollbackMethodId(env); - if(m_jMarkRollbackMethodId == nullptr) { + if (m_jMarkRollbackMethodId == nullptr) { // exception thrown return; } m_jMarkCommitMethodId = WriteBatchHandlerJni::getMarkCommitMethodId(env); - if(m_jMarkCommitMethodId == nullptr) { + if (m_jMarkCommitMethodId == nullptr) { // exception thrown return; } @@ -129,7 +129,7 @@ WriteBatchHandlerJniCallback::WriteBatchHandlerJniCallback( } m_jContinueMethodId = WriteBatchHandlerJni::getContinueMethodId(env); - if(m_jContinueMethodId == nullptr) { + if (m_jContinueMethodId == nullptr) { // exception thrown return; } @@ -137,17 +137,12 @@ WriteBatchHandlerJniCallback::WriteBatchHandlerJniCallback( ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::PutCF( uint32_t column_family_id, const Slice& key, const Slice& value) { - auto put = [this, column_family_id] ( - jbyteArray j_key, jbyteArray j_value) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jPutCfMethodId, - static_cast(column_family_id), - j_key, - j_value); + auto put = [this, column_family_id](jbyteArray j_key, jbyteArray j_value) { + m_env->CallVoidMethod(m_jcallback_obj, m_jPutCfMethodId, + static_cast(column_family_id), j_key, j_value); }; auto status = WriteBatchHandlerJniCallback::kv_op(key, value, put); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -157,30 +152,20 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::PutCF( } void WriteBatchHandlerJniCallback::Put(const Slice& key, const Slice& value) { - auto put = [this] ( - jbyteArray j_key, jbyteArray j_value) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jPutMethodId, - j_key, - j_value); + auto put = [this](jbyteArray j_key, jbyteArray j_value) { + m_env->CallVoidMethod(m_jcallback_obj, m_jPutMethodId, j_key, j_value); }; WriteBatchHandlerJniCallback::kv_op(key, value, put); } ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MergeCF( uint32_t column_family_id, const Slice& key, const Slice& value) { - auto merge = [this, column_family_id] ( - jbyteArray j_key, jbyteArray j_value) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jMergeCfMethodId, - static_cast(column_family_id), - j_key, - j_value); + auto merge = [this, column_family_id](jbyteArray j_key, jbyteArray j_value) { + m_env->CallVoidMethod(m_jcallback_obj, m_jMergeCfMethodId, + static_cast(column_family_id), j_key, j_value); }; auto status = WriteBatchHandlerJniCallback::kv_op(key, value, merge); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -190,28 +175,20 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MergeCF( } void WriteBatchHandlerJniCallback::Merge(const Slice& key, const Slice& value) { - auto merge = [this] ( - jbyteArray j_key, jbyteArray j_value) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jMergeMethodId, - j_key, - j_value); + auto merge = [this](jbyteArray j_key, jbyteArray j_value) { + m_env->CallVoidMethod(m_jcallback_obj, m_jMergeMethodId, j_key, j_value); }; WriteBatchHandlerJniCallback::kv_op(key, value, merge); } ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::DeleteCF( uint32_t column_family_id, const Slice& key) { - auto remove = [this, column_family_id] (jbyteArray j_key) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jDeleteCfMethodId, - static_cast(column_family_id), - j_key); + auto remove = [this, column_family_id](jbyteArray j_key) { + m_env->CallVoidMethod(m_jcallback_obj, m_jDeleteCfMethodId, + static_cast(column_family_id), j_key); }; auto status = WriteBatchHandlerJniCallback::k_op(key, remove); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -221,26 +198,20 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::DeleteCF( } void WriteBatchHandlerJniCallback::Delete(const Slice& key) { - auto remove = [this] (jbyteArray j_key) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jDeleteMethodId, - j_key); + auto remove = [this](jbyteArray j_key) { + m_env->CallVoidMethod(m_jcallback_obj, m_jDeleteMethodId, j_key); }; WriteBatchHandlerJniCallback::k_op(key, remove); } ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::SingleDeleteCF( uint32_t column_family_id, const Slice& key) { - auto singleDelete = [this, column_family_id] (jbyteArray j_key) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jSingleDeleteCfMethodId, - static_cast(column_family_id), - j_key); + auto singleDelete = [this, column_family_id](jbyteArray j_key) { + m_env->CallVoidMethod(m_jcallback_obj, m_jSingleDeleteCfMethodId, + static_cast(column_family_id), j_key); }; auto status = WriteBatchHandlerJniCallback::k_op(key, singleDelete); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -250,28 +221,23 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::SingleDeleteCF( } void WriteBatchHandlerJniCallback::SingleDelete(const Slice& key) { - auto singleDelete = [this] (jbyteArray j_key) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jSingleDeleteMethodId, - j_key); + auto singleDelete = [this](jbyteArray j_key) { + m_env->CallVoidMethod(m_jcallback_obj, m_jSingleDeleteMethodId, j_key); }; WriteBatchHandlerJniCallback::k_op(key, singleDelete); } ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::DeleteRangeCF( uint32_t column_family_id, const Slice& beginKey, const Slice& endKey) { - auto deleteRange = [this, column_family_id] ( - jbyteArray j_beginKey, jbyteArray j_endKey) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jDeleteRangeCfMethodId, - static_cast(column_family_id), - j_beginKey, - j_endKey); + auto deleteRange = [this, column_family_id](jbyteArray j_beginKey, + jbyteArray j_endKey) { + m_env->CallVoidMethod(m_jcallback_obj, m_jDeleteRangeCfMethodId, + static_cast(column_family_id), j_beginKey, + j_endKey); }; - auto status = WriteBatchHandlerJniCallback::kv_op(beginKey, endKey, deleteRange); - if(status == nullptr) { + auto status = + WriteBatchHandlerJniCallback::kv_op(beginKey, endKey, deleteRange); + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -281,41 +247,30 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::DeleteRangeCF( } void WriteBatchHandlerJniCallback::DeleteRange(const Slice& beginKey, - const Slice& endKey) { - auto deleteRange = [this] ( - jbyteArray j_beginKey, jbyteArray j_endKey) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jDeleteRangeMethodId, - j_beginKey, - j_endKey); + const Slice& endKey) { + auto deleteRange = [this](jbyteArray j_beginKey, jbyteArray j_endKey) { + m_env->CallVoidMethod(m_jcallback_obj, m_jDeleteRangeMethodId, j_beginKey, + j_endKey); }; WriteBatchHandlerJniCallback::kv_op(beginKey, endKey, deleteRange); } void WriteBatchHandlerJniCallback::LogData(const Slice& blob) { - auto logData = [this] (jbyteArray j_blob) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jLogDataMethodId, - j_blob); + auto logData = [this](jbyteArray j_blob) { + m_env->CallVoidMethod(m_jcallback_obj, m_jLogDataMethodId, j_blob); }; WriteBatchHandlerJniCallback::k_op(blob, logData); } ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::PutBlobIndexCF( uint32_t column_family_id, const Slice& key, const Slice& value) { - auto putBlobIndex = [this, column_family_id] ( - jbyteArray j_key, jbyteArray j_value) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jPutBlobIndexCfMethodId, - static_cast(column_family_id), - j_key, - j_value); + auto putBlobIndex = [this, column_family_id](jbyteArray j_key, + jbyteArray j_value) { + m_env->CallVoidMethod(m_jcallback_obj, m_jPutBlobIndexCfMethodId, + static_cast(column_family_id), j_key, j_value); }; auto status = WriteBatchHandlerJniCallback::kv_op(key, value, putBlobIndex); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -327,7 +282,7 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::PutBlobIndexCF( ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkBeginPrepare( bool unprepare) { #ifndef DEBUG - (void) unprepare; + (void)unprepare; #else assert(!unprepare); #endif @@ -346,7 +301,8 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkBeginPrepare( // better error code here } else { - m_env->ExceptionClear(); // clear the exception, as we have extracted the status + m_env->ExceptionClear(); // clear the exception, as we have extracted the + // status return ROCKSDB_NAMESPACE::Status(*status); } } @@ -356,15 +312,11 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkBeginPrepare( ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkEndPrepare( const Slice& xid) { - auto markEndPrepare = [this] ( - jbyteArray j_xid) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jMarkEndPrepareMethodId, - j_xid); + auto markEndPrepare = [this](jbyteArray j_xid) { + m_env->CallVoidMethod(m_jcallback_obj, m_jMarkEndPrepareMethodId, j_xid); }; auto status = WriteBatchHandlerJniCallback::k_op(xid, markEndPrepare); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -375,7 +327,8 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkEndPrepare( ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkNoop( bool empty_batch) { - m_env->CallVoidMethod(m_jcallback_obj, m_jMarkNoopMethodId, static_cast(empty_batch)); + m_env->CallVoidMethod(m_jcallback_obj, m_jMarkNoopMethodId, + static_cast(empty_batch)); // check for Exception, in-particular RocksDBException if (m_env->ExceptionCheck()) { @@ -390,7 +343,8 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkNoop( // better error code here } else { - m_env->ExceptionClear(); // clear the exception, as we have extracted the status + m_env->ExceptionClear(); // clear the exception, as we have extracted the + // status return ROCKSDB_NAMESPACE::Status(*status); } } @@ -400,15 +354,11 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkNoop( ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkRollback( const Slice& xid) { - auto markRollback = [this] ( - jbyteArray j_xid) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jMarkRollbackMethodId, - j_xid); + auto markRollback = [this](jbyteArray j_xid) { + m_env->CallVoidMethod(m_jcallback_obj, m_jMarkRollbackMethodId, j_xid); }; auto status = WriteBatchHandlerJniCallback::k_op(xid, markRollback); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -419,15 +369,11 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkRollback( ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkCommit( const Slice& xid) { - auto markCommit = [this] ( - jbyteArray j_xid) { - m_env->CallVoidMethod( - m_jcallback_obj, - m_jMarkCommitMethodId, - j_xid); + auto markCommit = [this](jbyteArray j_xid) { + m_env->CallVoidMethod(m_jcallback_obj, m_jMarkCommitMethodId, j_xid); }; auto status = WriteBatchHandlerJniCallback::k_op(xid, markCommit); - if(status == nullptr) { + if (status == nullptr) { return ROCKSDB_NAMESPACE::Status::OK(); // TODO(AR) what to do if there is // an Exception but we don't know // the ROCKSDB_NAMESPACE::Status? @@ -454,10 +400,9 @@ ROCKSDB_NAMESPACE::Status WriteBatchHandlerJniCallback::MarkCommitWithTimestamp( } bool WriteBatchHandlerJniCallback::Continue() { - jboolean jContinue = m_env->CallBooleanMethod( - m_jcallback_obj, - m_jContinueMethodId); - if(m_env->ExceptionCheck()) { + jboolean jContinue = + m_env->CallBooleanMethod(m_jcallback_obj, m_jContinueMethodId); + if (m_env->ExceptionCheck()) { // exception thrown m_env->ExceptionDescribe(); } @@ -510,7 +455,8 @@ std::unique_ptr WriteBatchHandlerJniCallback::kv_op( return nullptr; } else { - m_env->ExceptionClear(); // clear the exception, as we have extracted the status + m_env->ExceptionClear(); // clear the exception, as we have extracted the + // status return status; } } @@ -556,7 +502,8 @@ std::unique_ptr WriteBatchHandlerJniCallback::k_op( return nullptr; } else { - m_env->ExceptionClear(); // clear the exception, as we have extracted the status + m_env->ExceptionClear(); // clear the exception, as we have extracted the + // status return status; } } diff --git a/java/rocksjni/writebatchhandlerjnicallback.h b/java/rocksjni/writebatchhandlerjnicallback.h index c12ffe0d9..9629797ca 100644 --- a/java/rocksjni/writebatchhandlerjnicallback.h +++ b/java/rocksjni/writebatchhandlerjnicallback.h @@ -9,11 +9,13 @@ #ifndef JAVA_ROCKSJNI_WRITEBATCHHANDLERJNICALLBACK_H_ #define JAVA_ROCKSJNI_WRITEBATCHHANDLERJNICALLBACK_H_ -#include #include + +#include #include -#include "rocksjni/jnicallback.h" + #include "rocksdb/write_batch.h" +#include "rocksjni/jnicallback.h" namespace ROCKSDB_NAMESPACE { /** @@ -23,68 +25,67 @@ namespace ROCKSDB_NAMESPACE { * which calls the appropriate Java method. * This enables Write Batch Handlers to be implemented in Java. */ -class WriteBatchHandlerJniCallback : public JniCallback, public WriteBatch::Handler { +class WriteBatchHandlerJniCallback : public JniCallback, + public WriteBatch::Handler { public: - WriteBatchHandlerJniCallback( - JNIEnv* env, jobject jWriteBackHandler); - Status PutCF(uint32_t column_family_id, const Slice& key, - const Slice& value); - void Put(const Slice& key, const Slice& value); - Status MergeCF(uint32_t column_family_id, const Slice& key, - const Slice& value); - void Merge(const Slice& key, const Slice& value); - Status DeleteCF(uint32_t column_family_id, const Slice& key); - void Delete(const Slice& key); - Status SingleDeleteCF(uint32_t column_family_id, const Slice& key); - void SingleDelete(const Slice& key); - Status DeleteRangeCF(uint32_t column_family_id, const Slice& beginKey, - const Slice& endKey); - void DeleteRange(const Slice& beginKey, const Slice& endKey); - void LogData(const Slice& blob); - Status PutBlobIndexCF(uint32_t column_family_id, const Slice& key, - const Slice& value); - Status MarkBeginPrepare(bool); - Status MarkEndPrepare(const Slice& xid); - Status MarkNoop(bool empty_batch); - Status MarkRollback(const Slice& xid); - Status MarkCommit(const Slice& xid); - Status MarkCommitWithTimestamp(const Slice& xid, const Slice& commit_ts); - bool Continue(); + WriteBatchHandlerJniCallback(JNIEnv* env, jobject jWriteBackHandler); + Status PutCF(uint32_t column_family_id, const Slice& key, const Slice& value); + void Put(const Slice& key, const Slice& value); + Status MergeCF(uint32_t column_family_id, const Slice& key, + const Slice& value); + void Merge(const Slice& key, const Slice& value); + Status DeleteCF(uint32_t column_family_id, const Slice& key); + void Delete(const Slice& key); + Status SingleDeleteCF(uint32_t column_family_id, const Slice& key); + void SingleDelete(const Slice& key); + Status DeleteRangeCF(uint32_t column_family_id, const Slice& beginKey, + const Slice& endKey); + void DeleteRange(const Slice& beginKey, const Slice& endKey); + void LogData(const Slice& blob); + Status PutBlobIndexCF(uint32_t column_family_id, const Slice& key, + const Slice& value); + Status MarkBeginPrepare(bool); + Status MarkEndPrepare(const Slice& xid); + Status MarkNoop(bool empty_batch); + Status MarkRollback(const Slice& xid); + Status MarkCommit(const Slice& xid); + Status MarkCommitWithTimestamp(const Slice& xid, const Slice& commit_ts); + bool Continue(); private: - JNIEnv* m_env; - jmethodID m_jPutCfMethodId; - jmethodID m_jPutMethodId; - jmethodID m_jMergeCfMethodId; - jmethodID m_jMergeMethodId; - jmethodID m_jDeleteCfMethodId; - jmethodID m_jDeleteMethodId; - jmethodID m_jSingleDeleteCfMethodId; - jmethodID m_jSingleDeleteMethodId; - jmethodID m_jDeleteRangeCfMethodId; - jmethodID m_jDeleteRangeMethodId; - jmethodID m_jLogDataMethodId; - jmethodID m_jPutBlobIndexCfMethodId; - jmethodID m_jMarkBeginPrepareMethodId; - jmethodID m_jMarkEndPrepareMethodId; - jmethodID m_jMarkNoopMethodId; - jmethodID m_jMarkRollbackMethodId; - jmethodID m_jMarkCommitMethodId; - jmethodID m_jMarkCommitWithTimestampMethodId; - jmethodID m_jContinueMethodId; - /** - * @return A pointer to a ROCKSDB_NAMESPACE::Status or nullptr if an - * unexpected exception occurred - */ - std::unique_ptr kv_op( - const Slice& key, const Slice& value, - std::function kvFn); - /** - * @return A pointer to a ROCKSDB_NAMESPACE::Status or nullptr if an - * unexpected exception occurred - */ - std::unique_ptr k_op( - const Slice& key, std::function kFn); + JNIEnv* m_env; + jmethodID m_jPutCfMethodId; + jmethodID m_jPutMethodId; + jmethodID m_jMergeCfMethodId; + jmethodID m_jMergeMethodId; + jmethodID m_jDeleteCfMethodId; + jmethodID m_jDeleteMethodId; + jmethodID m_jSingleDeleteCfMethodId; + jmethodID m_jSingleDeleteMethodId; + jmethodID m_jDeleteRangeCfMethodId; + jmethodID m_jDeleteRangeMethodId; + jmethodID m_jLogDataMethodId; + jmethodID m_jPutBlobIndexCfMethodId; + jmethodID m_jMarkBeginPrepareMethodId; + jmethodID m_jMarkEndPrepareMethodId; + jmethodID m_jMarkNoopMethodId; + jmethodID m_jMarkRollbackMethodId; + jmethodID m_jMarkCommitMethodId; + jmethodID m_jMarkCommitWithTimestampMethodId; + jmethodID m_jContinueMethodId; + /** + * @return A pointer to a ROCKSDB_NAMESPACE::Status or nullptr if an + * unexpected exception occurred + */ + std::unique_ptr kv_op( + const Slice& key, const Slice& value, + std::function kvFn); + /** + * @return A pointer to a ROCKSDB_NAMESPACE::Status or nullptr if an + * unexpected exception occurred + */ + std::unique_ptr k_op( + const Slice& key, std::function kFn); }; } // namespace ROCKSDB_NAMESPACE