// Copyright (c) 2014, Facebook, Inc. All rights reserved. // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. // // This file implements the "bridge" between Java and C++ for rocksdb::Options. #include #include #include #include #include #include "include/org_rocksdb_Options.h" #include "include/org_rocksdb_WriteOptions.h" #include "include/org_rocksdb_ReadOptions.h" #include "rocksjni/portal.h" #include "rocksdb/db.h" #include "rocksdb/options.h" #include "rocksdb/statistics.h" #include "rocksdb/memtablerep.h" #include "rocksdb/table.h" #include "rocksdb/slice_transform.h" #include "rocksdb/filter_policy.h" /* * Class: org_rocksdb_Options * Method: newOptions * Signature: ()V */ void Java_org_rocksdb_Options_newOptions(JNIEnv* env, jobject jobj) { rocksdb::Options* op = new rocksdb::Options(); rocksdb::OptionsJni::setHandle(env, jobj, op); } /* * Class: org_rocksdb_Options * Method: dispose0 * Signature: ()V */ void Java_org_rocksdb_Options_dispose0(JNIEnv* env, jobject jobj) { rocksdb::Options* op = rocksdb::OptionsJni::getHandle(env, jobj); delete op; rocksdb::OptionsJni::setHandle(env, jobj, nullptr); } /* * Class: org_rocksdb_Options * Method: setCreateIfMissing * Signature: (JZ)V */ void Java_org_rocksdb_Options_setCreateIfMissing( JNIEnv* env, jobject jobj, jlong jhandle, jboolean flag) { reinterpret_cast(jhandle)->create_if_missing = flag; } /* * Class: org_rocksdb_Options * Method: createIfMissing * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_createIfMissing( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->create_if_missing; } /* * Class: org_rocksdb_Options * Method: setWriteBufferSize * Signature: (JJ)I */ void Java_org_rocksdb_Options_setWriteBufferSize( JNIEnv* env, jobject jobj, jlong jhandle, jlong jwrite_buffer_size) { reinterpret_cast(jhandle)->write_buffer_size = static_cast(jwrite_buffer_size); } /* * Class: org_rocksdb_Options * Method: writeBufferSize * Signature: (J)J */ jlong Java_org_rocksdb_Options_writeBufferSize( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->write_buffer_size; } /* * Class: org_rocksdb_Options * Method: setMaxWriteBufferNumber * Signature: (JI)V */ void Java_org_rocksdb_Options_setMaxWriteBufferNumber( JNIEnv* env, jobject jobj, jlong jhandle, jint jmax_write_buffer_number) { reinterpret_cast(jhandle)->max_write_buffer_number = jmax_write_buffer_number; } /* * Class: org_rocksdb_Options * Method: createStatistics * Signature: (J)V */ void Java_org_rocksdb_Options_createStatistics( JNIEnv* env, jobject jobj, jlong jOptHandle) { reinterpret_cast(jOptHandle)->statistics = rocksdb::CreateDBStatistics(); } /* * Class: org_rocksdb_Options * Method: statisticsPtr * Signature: (J)J */ jlong Java_org_rocksdb_Options_statisticsPtr( JNIEnv* env, jobject jobj, jlong jOptHandle) { auto st = reinterpret_cast(jOptHandle)->statistics.get(); return reinterpret_cast(st); } /* * Class: org_rocksdb_Options * Method: setFilter0 * Signature: (JJ)V */ void Java_org_rocksdb_Options_setFilter0( JNIEnv* env, jobject jobj, jlong jopt_handle, jlong jfp_handle) { reinterpret_cast(jopt_handle)->filter_policy = reinterpret_cast(jfp_handle); } /* * Class: org_rocksdb_Options * Method: maxWriteBufferNumber * Signature: (J)I */ jint Java_org_rocksdb_Options_maxWriteBufferNumber( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->max_write_buffer_number; } /* * Class: org_rocksdb_Options * Method: setBlockSize * Signature: (JJ)V */ void Java_org_rocksdb_Options_setBlockSize( JNIEnv* env, jobject jobj, jlong jhandle, jlong jblock_size) { reinterpret_cast(jhandle)->block_size = static_cast(jblock_size); } /* * Class: org_rocksdb_Options * Method: blockSize * Signature: (J)J */ jlong Java_org_rocksdb_Options_blockSize( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->block_size; } /* * Class: org_rocksdb_Options * Method: setDisableSeekCompaction * Signature: (JZ)V */ void Java_org_rocksdb_Options_setDisableSeekCompaction( JNIEnv* env, jobject jobj, jlong jhandle, jboolean jdisable_seek_compaction) { reinterpret_cast(jhandle)->disable_seek_compaction = jdisable_seek_compaction; } /* * Class: org_rocksdb_Options * Method: disableSeekCompaction * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_disableSeekCompaction( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->disable_seek_compaction; } /* * Class: org_rocksdb_Options * Method: errorIfExists * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_errorIfExists( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->error_if_exists; } /* * Class: org_rocksdb_Options * Method: setErrorIfExists * Signature: (JZ)V */ void Java_org_rocksdb_Options_setErrorIfExists( JNIEnv* env, jobject jobj, jlong jhandle, jboolean error_if_exists) { reinterpret_cast(jhandle)->error_if_exists = static_cast(error_if_exists); } /* * Class: org_rocksdb_Options * Method: paranoidChecks * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_paranoidChecks( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->paranoid_checks; } /* * Class: org_rocksdb_Options * Method: setParanoidChecks * Signature: (JZ)V */ void Java_org_rocksdb_Options_setParanoidChecks( JNIEnv* env, jobject jobj, jlong jhandle, jboolean paranoid_checks) { reinterpret_cast(jhandle)->paranoid_checks = static_cast(paranoid_checks); } /* * Class: org_rocksdb_Options * Method: maxOpenFiles * Signature: (J)I */ jint Java_org_rocksdb_Options_maxOpenFiles( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->max_open_files; } /* * Class: org_rocksdb_Options * Method: setMaxOpenFiles * Signature: (JI)V */ void Java_org_rocksdb_Options_setMaxOpenFiles( JNIEnv* env, jobject jobj, jlong jhandle, jint max_open_files) { reinterpret_cast(jhandle)->max_open_files = static_cast(max_open_files); } /* * Class: org_rocksdb_Options * Method: disableDataSync * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_disableDataSync( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->disableDataSync; } /* * Class: org_rocksdb_Options * Method: setDisableDataSync * Signature: (JZ)V */ void Java_org_rocksdb_Options_setDisableDataSync( JNIEnv* env, jobject jobj, jlong jhandle, jboolean disableDataSync) { reinterpret_cast(jhandle)->disableDataSync = static_cast(disableDataSync); } /* * Class: org_rocksdb_Options * Method: useFsync * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_useFsync( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->use_fsync; } /* * Class: org_rocksdb_Options * Method: setUseFsync * Signature: (JZ)V */ void Java_org_rocksdb_Options_setUseFsync( JNIEnv* env, jobject jobj, jlong jhandle, jboolean use_fsync) { reinterpret_cast(jhandle)->use_fsync = static_cast(use_fsync); } /* * Class: org_rocksdb_Options * Method: dbStatsLogInterval * Signature: (J)I */ jint Java_org_rocksdb_Options_dbStatsLogInterval( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->db_stats_log_interval; } /* * Class: org_rocksdb_Options * Method: setDbStatsLogInterval * Signature: (JI)V */ void Java_org_rocksdb_Options_setDbStatsLogInterval( JNIEnv* env, jobject jobj, jlong jhandle, jint db_stats_log_interval) { reinterpret_cast(jhandle)->db_stats_log_interval = static_cast(db_stats_log_interval); } /* * Class: org_rocksdb_Options * Method: dbLogDir * Signature: (J)Ljava/lang/String */ jstring Java_org_rocksdb_Options_dbLogDir( JNIEnv* env, jobject jobj, jlong jhandle) { return env->NewStringUTF( reinterpret_cast(jhandle)->db_log_dir.c_str()); } /* * Class: org_rocksdb_Options * Method: setDbLogDir * Signature: (JLjava/lang/String)V */ void Java_org_rocksdb_Options_setDbLogDir( JNIEnv* env, jobject jobj, jlong jhandle, jstring jdb_log_dir) { const char* log_dir = env->GetStringUTFChars(jdb_log_dir, 0); reinterpret_cast(jhandle)->db_log_dir.assign(log_dir); env->ReleaseStringUTFChars(jdb_log_dir, log_dir); } /* * Class: org_rocksdb_Options * Method: walDir * Signature: (J)Ljava/lang/String */ jstring Java_org_rocksdb_Options_walDir( JNIEnv* env, jobject jobj, jlong jhandle) { return env->NewStringUTF( reinterpret_cast(jhandle)->wal_dir.c_str()); } /* * Class: org_rocksdb_Options * Method: setWalDir * Signature: (JLjava/lang/String)V */ void Java_org_rocksdb_Options_setWalDir( JNIEnv* env, jobject jobj, jlong jhandle, jstring jwal_dir) { const char* wal_dir = env->GetStringUTFChars(jwal_dir, 0); reinterpret_cast(jhandle)->wal_dir.assign(wal_dir); env->ReleaseStringUTFChars(jwal_dir, wal_dir); } /* * Class: org_rocksdb_Options * Method: deleteObsoleteFilesPeriodMicros * Signature: (J)J */ jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros; } /* * Class: org_rocksdb_Options * Method: setDeleteObsoleteFilesPeriodMicros * Signature: (JJ)V */ void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros( JNIEnv* env, jobject jobj, jlong jhandle, jlong micros) { reinterpret_cast(jhandle) ->delete_obsolete_files_period_micros = static_cast(micros); } /* * Class: org_rocksdb_Options * Method: maxBackgroundCompactions * Signature: (J)I */ jint Java_org_rocksdb_Options_maxBackgroundCompactions( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast( jhandle)->max_background_compactions; } /* * Class: org_rocksdb_Options * Method: setMaxBackgroundCompactions * Signature: (JI)V */ void Java_org_rocksdb_Options_setMaxBackgroundCompactions( JNIEnv* env, jobject jobj, jlong jhandle, jint max) { reinterpret_cast(jhandle) ->max_background_compactions = static_cast(max); } /* * Class: org_rocksdb_Options * Method: maxBackgroundFlushes * Signature: (J)I */ jint Java_org_rocksdb_Options_maxBackgroundFlushes( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->max_background_flushes; } /* * Class: org_rocksdb_Options * Method: setMaxBackgroundFlushes * Signature: (JI)V */ void Java_org_rocksdb_Options_setMaxBackgroundFlushes( JNIEnv* env, jobject jobj, jlong jhandle, jint max_background_flushes) { reinterpret_cast(jhandle)->max_background_flushes = static_cast(max_background_flushes); } /* * Class: org_rocksdb_Options * Method: maxLogFileSize * Signature: (J)J */ jlong Java_org_rocksdb_Options_maxLogFileSize( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->max_log_file_size; } /* * Class: org_rocksdb_Options * Method: setMaxLogFileSize * Signature: (JJ)V */ void Java_org_rocksdb_Options_setMaxLogFileSize( JNIEnv* env, jobject jobj, jlong jhandle, jlong max_log_file_size) { reinterpret_cast(jhandle)->max_log_file_size = static_cast(max_log_file_size); } /* * Class: org_rocksdb_Options * Method: logFileTimeToRoll * Signature: (J)J */ jlong Java_org_rocksdb_Options_logFileTimeToRoll( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->log_file_time_to_roll; } /* * Class: org_rocksdb_Options * Method: setLogFileTimeToRoll * Signature: (JJ)V */ void Java_org_rocksdb_Options_setLogFileTimeToRoll( JNIEnv* env, jobject jobj, jlong jhandle, jlong log_file_time_to_roll) { reinterpret_cast(jhandle)->log_file_time_to_roll = static_cast(log_file_time_to_roll); } /* * Class: org_rocksdb_Options * Method: keepLogFileNum * Signature: (J)J */ jlong Java_org_rocksdb_Options_keepLogFileNum( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->keep_log_file_num; } /* * Class: org_rocksdb_Options * Method: setKeepLogFileNum * Signature: (JJ)V */ void Java_org_rocksdb_Options_setKeepLogFileNum( JNIEnv* env, jobject jobj, jlong jhandle, jlong keep_log_file_num) { reinterpret_cast(jhandle)->keep_log_file_num = static_cast(keep_log_file_num); } /* * Class: org_rocksdb_Options * Method: maxManifestFileSize * Signature: (J)J */ jlong Java_org_rocksdb_Options_maxManifestFileSize( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->max_manifest_file_size; } /* * Method: memTableFactoryName * Signature: (J)Ljava/lang/String */ jstring Java_org_rocksdb_Options_memTableFactoryName( JNIEnv* env, jobject jobj, jlong jhandle) { auto opt = reinterpret_cast(jhandle); rocksdb::MemTableRepFactory* tf = opt->memtable_factory.get(); // Should never be nullptr. // Default memtable factory is SkipListFactory assert(tf); // temporarly fix for the historical typo if (strcmp(tf->Name(), "HashLinkListRepFactory") == 0) { return env->NewStringUTF("HashLinkedListRepFactory"); } return env->NewStringUTF(tf->Name()); } /* * Class: org_rocksdb_Options * Method: setMaxManifestFileSize * Signature: (JJ)V */ void Java_org_rocksdb_Options_setMaxManifestFileSize( JNIEnv* env, jobject jobj, jlong jhandle, jlong max_manifest_file_size) { reinterpret_cast(jhandle)->max_manifest_file_size = static_cast(max_manifest_file_size); } /* * Method: setMemTableFactory * Signature: (JJ)V */ void Java_org_rocksdb_Options_setMemTableFactory( JNIEnv* env, jobject jobj, jlong jhandle, jlong jfactory_handle) { reinterpret_cast(jhandle)->memtable_factory.reset( reinterpret_cast(jfactory_handle)); } /* * Class: org_rocksdb_Options * Method: tableCacheNumshardbits * Signature: (J)I */ jint Java_org_rocksdb_Options_tableCacheNumshardbits( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->table_cache_numshardbits; } /* * Class: org_rocksdb_Options * Method: setTableCacheNumshardbits * Signature: (JI)V */ void Java_org_rocksdb_Options_setTableCacheNumshardbits( JNIEnv* env, jobject jobj, jlong jhandle, jint table_cache_numshardbits) { reinterpret_cast(jhandle)->table_cache_numshardbits = static_cast(table_cache_numshardbits); } /* * Class: org_rocksdb_Options * Method: tableCacheRemoveScanCountLimit * Signature: (J)I */ jint Java_org_rocksdb_Options_tableCacheRemoveScanCountLimit( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast( jhandle)->table_cache_remove_scan_count_limit; } /* * Class: org_rocksdb_Options * Method: setTableCacheRemoveScanCountLimit * Signature: (JI)V */ void Java_org_rocksdb_Options_setTableCacheRemoveScanCountLimit( JNIEnv* env, jobject jobj, jlong jhandle, jint limit) { reinterpret_cast( jhandle)->table_cache_remove_scan_count_limit = static_cast(limit); } /* * Method: useFixedLengthPrefixExtractor * Signature: (JI)V */ void Java_org_rocksdb_Options_useFixedLengthPrefixExtractor( JNIEnv* env, jobject jobj, jlong jhandle, jint jprefix_length) { reinterpret_cast(jhandle)->prefix_extractor.reset( rocksdb::NewFixedPrefixTransform(static_cast(jprefix_length))); } /* * Class: org_rocksdb_Options * Method: walTtlSeconds * Signature: (J)J */ jlong Java_org_rocksdb_Options_walTtlSeconds( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->WAL_ttl_seconds; } /* * Class: org_rocksdb_Options * Method: setWALTtlSeconds * Signature: (JJ)V */ void Java_org_rocksdb_Options_setWALTtlSeconds( JNIEnv* env, jobject jobj, jlong jhandle, jlong WAL_ttl_seconds) { reinterpret_cast(jhandle)->WAL_ttl_seconds = static_cast(WAL_ttl_seconds); } /* * Class: org_rocksdb_Options * Method: manifestPreallocationSize * Signature: (J)J */ jlong Java_org_rocksdb_Options_manifestPreallocationSize( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle) ->manifest_preallocation_size; } /* * Class: org_rocksdb_Options * Method: setManifestPreallocationSize * Signature: (JJ)V */ void Java_org_rocksdb_Options_setManifestPreallocationSize( JNIEnv* env, jobject jobj, jlong jhandle, jlong preallocation_size) { reinterpret_cast(jhandle)->manifest_preallocation_size = static_cast(preallocation_size); } /* * Class: org_rocksdb_Options * Method: allowOsBuffer * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_allowOsBuffer( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->allow_os_buffer; } /* * Class: org_rocksdb_Options * Method: setAllowOsBuffer * Signature: (JZ)V */ void Java_org_rocksdb_Options_setAllowOsBuffer( JNIEnv* env, jobject jobj, jlong jhandle, jboolean allow_os_buffer) { reinterpret_cast(jhandle)->allow_os_buffer = static_cast(allow_os_buffer); } /* * Method: setTableFactory * Signature: (JJ)V */ void Java_org_rocksdb_Options_setTableFactory( JNIEnv* env, jobject jobj, jlong jhandle, jlong jfactory_handle) { reinterpret_cast(jhandle)->table_factory.reset( reinterpret_cast(jfactory_handle)); } /* * Class: org_rocksdb_Options * Method: allowMmapReads * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_allowMmapReads( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->allow_mmap_reads; } /* * Class: org_rocksdb_Options * Method: setAllowMmapReads * Signature: (JZ)V */ void Java_org_rocksdb_Options_setAllowMmapReads( JNIEnv* env, jobject jobj, jlong jhandle, jboolean allow_mmap_reads) { reinterpret_cast(jhandle)->allow_mmap_reads = static_cast(allow_mmap_reads); } /* * Class: org_rocksdb_Options * Method: allowMmapWrites * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_allowMmapWrites( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->allow_mmap_writes; } /* * Class: org_rocksdb_Options * Method: setAllowMmapWrites * Signature: (JZ)V */ void Java_org_rocksdb_Options_setAllowMmapWrites( JNIEnv* env, jobject jobj, jlong jhandle, jboolean allow_mmap_writes) { reinterpret_cast(jhandle)->allow_mmap_writes = static_cast(allow_mmap_writes); } /* * Class: org_rocksdb_Options * Method: isFdCloseOnExec * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_isFdCloseOnExec( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->is_fd_close_on_exec; } /* * Class: org_rocksdb_Options * Method: setIsFdCloseOnExec * Signature: (JZ)V */ void Java_org_rocksdb_Options_setIsFdCloseOnExec( JNIEnv* env, jobject jobj, jlong jhandle, jboolean is_fd_close_on_exec) { reinterpret_cast(jhandle)->is_fd_close_on_exec = static_cast(is_fd_close_on_exec); } /* * Class: org_rocksdb_Options * Method: skipLogErrorOnRecovery * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_skipLogErrorOnRecovery( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle) ->skip_log_error_on_recovery; } /* * Class: org_rocksdb_Options * Method: setSkipLogErrorOnRecovery * Signature: (JZ)V */ void Java_org_rocksdb_Options_setSkipLogErrorOnRecovery( JNIEnv* env, jobject jobj, jlong jhandle, jboolean skip) { reinterpret_cast(jhandle)->skip_log_error_on_recovery = static_cast(skip); } /* * Class: org_rocksdb_Options * Method: statsDumpPeriodSec * Signature: (J)I */ jint Java_org_rocksdb_Options_statsDumpPeriodSec( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->stats_dump_period_sec; } /* * Class: org_rocksdb_Options * Method: setStatsDumpPeriodSec * Signature: (JI)V */ void Java_org_rocksdb_Options_setStatsDumpPeriodSec( JNIEnv* env, jobject jobj, jlong jhandle, jint stats_dump_period_sec) { reinterpret_cast(jhandle)->stats_dump_period_sec = static_cast(stats_dump_period_sec); } /* * Class: org_rocksdb_Options * Method: adviseRandomOnOpen * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_adviseRandomOnOpen( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->advise_random_on_open; } /* * Class: org_rocksdb_Options * Method: setAdviseRandomOnOpen * Signature: (JZ)V */ void Java_org_rocksdb_Options_setAdviseRandomOnOpen( JNIEnv* env, jobject jobj, jlong jhandle, jboolean advise_random_on_open) { reinterpret_cast(jhandle)->advise_random_on_open = static_cast(advise_random_on_open); } /* * Class: org_rocksdb_Options * Method: useAdaptiveMutex * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_useAdaptiveMutex( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->use_adaptive_mutex; } /* * Class: org_rocksdb_Options * Method: setUseAdaptiveMutex * Signature: (JZ)V */ void Java_org_rocksdb_Options_setUseAdaptiveMutex( JNIEnv* env, jobject jobj, jlong jhandle, jboolean use_adaptive_mutex) { reinterpret_cast(jhandle)->use_adaptive_mutex = static_cast(use_adaptive_mutex); } /* * Class: org_rocksdb_Options * Method: bytesPerSync * Signature: (J)J */ jlong Java_org_rocksdb_Options_bytesPerSync( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->bytes_per_sync; } /* * Class: org_rocksdb_Options * Method: setBytesPerSync * Signature: (JJ)V */ void Java_org_rocksdb_Options_setBytesPerSync( JNIEnv* env, jobject jobj, jlong jhandle, jlong bytes_per_sync) { reinterpret_cast(jhandle)->bytes_per_sync = static_cast(bytes_per_sync); } /* * Class: org_rocksdb_Options * Method: allowThreadLocal * Signature: (J)Z */ jboolean Java_org_rocksdb_Options_allowThreadLocal( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->allow_thread_local; } /* * Class: org_rocksdb_Options * Method: setAllowThreadLocal * Signature: (JZ)V */ void Java_org_rocksdb_Options_setAllowThreadLocal( JNIEnv* env, jobject jobj, jlong jhandle, jboolean allow_thread_local) { reinterpret_cast(jhandle)->allow_thread_local = static_cast(allow_thread_local); } /* * Method: tableFactoryName * Signature: (J)Ljava/lang/String */ jstring Java_org_rocksdb_Options_tableFactoryName( JNIEnv* env, jobject jobj, jlong jhandle) { auto opt = reinterpret_cast(jhandle); rocksdb::TableFactory* tf = opt->table_factory.get(); // Should never be nullptr. // Default memtable factory is SkipListFactory assert(tf); return env->NewStringUTF(tf->Name()); } ////////////////////////////////////////////////////////////////////////////// // WriteOptions /* * Class: org_rocksdb_WriteOptions * Method: newWriteOptions * Signature: ()V */ void Java_org_rocksdb_WriteOptions_newWriteOptions( JNIEnv* env, jobject jwrite_options) { rocksdb::WriteOptions* op = new rocksdb::WriteOptions(); rocksdb::WriteOptionsJni::setHandle(env, jwrite_options, op); } /* * Class: org_rocksdb_WriteOptions * Method: dispose0 * Signature: ()V */ void Java_org_rocksdb_WriteOptions_dispose0( JNIEnv* env, jobject jwrite_options, jlong jhandle) { auto write_options = reinterpret_cast(jhandle); delete write_options; rocksdb::WriteOptionsJni::setHandle(env, jwrite_options, nullptr); } /* * Class: org_rocksdb_WriteOptions * Method: setSync * Signature: (JZ)V */ void Java_org_rocksdb_WriteOptions_setSync( JNIEnv* env, jobject jwrite_options, jlong jhandle, jboolean jflag) { reinterpret_cast(jhandle)->sync = jflag; } /* * Class: org_rocksdb_WriteOptions * Method: sync * Signature: (J)Z */ jboolean Java_org_rocksdb_WriteOptions_sync( JNIEnv* env, jobject jwrite_options, jlong jhandle) { return reinterpret_cast(jhandle)->sync; } /* * Class: org_rocksdb_WriteOptions * Method: setDisableWAL * Signature: (JZ)V */ void Java_org_rocksdb_WriteOptions_setDisableWAL( JNIEnv* env, jobject jwrite_options, jlong jhandle, jboolean jflag) { reinterpret_cast(jhandle)->disableWAL = jflag; } /* * Class: org_rocksdb_WriteOptions * Method: disableWAL * Signature: (J)Z */ jboolean Java_org_rocksdb_WriteOptions_disableWAL( JNIEnv* env, jobject jwrite_options, jlong jhandle) { return reinterpret_cast(jhandle)->disableWAL; } ///////////////////////////////////////////////////////////////////// // rocksdb::ReadOptions /* * Class: org_rocksdb_ReadOptions * Method: newReadOptions * Signature: ()V */ void Java_org_rocksdb_ReadOptions_newReadOptions( JNIEnv* env, jobject jobj) { auto read_opt = new rocksdb::ReadOptions(); rocksdb::ReadOptionsJni::setHandle(env, jobj, read_opt); } /* * Class: org_rocksdb_ReadOptions * Method: dispose * Signature: (J)V */ void Java_org_rocksdb_ReadOptions_dispose( JNIEnv* env, jobject jobj, jlong jhandle) { delete reinterpret_cast(jhandle); rocksdb::ReadOptionsJni::setHandle(env, jobj, nullptr); } /* * Class: org_rocksdb_ReadOptions * Method: verifyChecksums * Signature: (J)Z */ jboolean Java_org_rocksdb_ReadOptions_verifyChecksums( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast( jhandle)->verify_checksums; } /* * Class: org_rocksdb_ReadOptions * Method: setVerifyChecksums * Signature: (JZ)V */ void Java_org_rocksdb_ReadOptions_setVerifyChecksums( JNIEnv* env, jobject jobj, jlong jhandle, jboolean jverify_checksums) { reinterpret_cast(jhandle)->verify_checksums = static_cast(jverify_checksums); } /* * Class: org_rocksdb_ReadOptions * Method: fillCache * Signature: (J)Z */ jboolean Java_org_rocksdb_ReadOptions_fillCache( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->fill_cache; } /* * Class: org_rocksdb_ReadOptions * Method: setFillCache * Signature: (JZ)V */ void Java_org_rocksdb_ReadOptions_setFillCache( JNIEnv* env, jobject jobj, jlong jhandle, jboolean jfill_cache) { reinterpret_cast(jhandle)->fill_cache = static_cast(jfill_cache); } /* * Class: org_rocksdb_ReadOptions * Method: prefixSeek * Signature: (J)Z */ jboolean Java_org_rocksdb_ReadOptions_prefixSeek( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->prefix_seek; } /* * Class: org_rocksdb_ReadOptions * Method: setPrefixSeek * Signature: (JZ)V */ void Java_org_rocksdb_ReadOptions_setPrefixSeek( JNIEnv* env, jobject jobj, jlong jhandle, jboolean jprefix_seek) { reinterpret_cast(jhandle)->prefix_seek = static_cast(jprefix_seek); } /* * Class: org_rocksdb_ReadOptions * Method: tailing * Signature: (J)Z */ jboolean Java_org_rocksdb_ReadOptions_tailing( JNIEnv* env, jobject jobj, jlong jhandle) { return reinterpret_cast(jhandle)->tailing; } /* * Class: org_rocksdb_ReadOptions * Method: setTailing * Signature: (JZ)V */ void Java_org_rocksdb_ReadOptions_setTailing( JNIEnv* env, jobject jobj, jlong jhandle, jboolean jtailing) { reinterpret_cast(jhandle)->tailing = static_cast(jtailing); }