You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rocksdb/java/rocksjni/options.cc

926 lines
26 KiB

// 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 <stdio.h>
#include <stdlib.h>
#include <jni.h>
#include <string>
#include <memory>
#include "include/org_rocksdb_Options.h"
#include "include/org_rocksdb_WriteOptions.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"
/*
* 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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->write_buffer_size =
static_cast<size_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jOptHandle)->statistics.get();
return reinterpret_cast<jlong>(st);
}
/*
* Class: org_rocksdb_Options
* Method: maxWriteBufferNumber
* Signature: (J)I
*/
jint Java_org_rocksdb_Options_maxWriteBufferNumber(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->block_size =
static_cast<size_t>(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<rocksdb::Options*>(jhandle)->block_size;
}
/*
* Class: org_rocksdb_Options
* Method: setDisableSeekCompaction
* Signature: (JZ)V
*/
void Java_org_rocksdb_Options_setDisableSeekCompaction(
JNIEnv* env, jobject jobj, jlong jhandle,
11 years ago
jboolean jdisable_seek_compaction) {
reinterpret_cast<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->error_if_exists =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->paranoid_checks =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->max_open_files =
static_cast<int>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->disableDataSync =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->use_fsync =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->db_stats_log_interval =
static_cast<int>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)
->delete_obsolete_files_period_micros =
static_cast<int64_t>(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<rocksdb::Options*>(
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<rocksdb::Options*>(jhandle)
->max_background_compactions = static_cast<int>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->max_background_flushes =
static_cast<int>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->max_log_file_size =
static_cast<size_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->log_file_time_to_roll =
static_cast<size_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->keep_log_file_num =
static_cast<size_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->max_manifest_file_size =
static_cast<int64_t>(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<rocksdb::Options*>(jhandle)->memtable_factory.reset(
reinterpret_cast<rocksdb::MemTableRepFactory*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->table_cache_numshardbits =
static_cast<int>(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<rocksdb::Options*>(
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<rocksdb::Options*>(
jhandle)->table_cache_remove_scan_count_limit = static_cast<int>(limit);
}
/*
* Method: useFixedLengthPrefixExtractor
* Signature: (JI)V
*/
void Java_org_rocksdb_Options_useFixedLengthPrefixExtractor(
JNIEnv* env, jobject jobj, jlong jhandle, jint jprefix_length) {
reinterpret_cast<rocksdb::Options*>(jhandle)->prefix_extractor.reset(
rocksdb::NewFixedPrefixTransform(static_cast<size_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->WAL_ttl_seconds =
static_cast<int64_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->manifest_preallocation_size =
static_cast<size_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->allow_os_buffer =
static_cast<bool>(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<rocksdb::Options*>(jhandle)->table_factory.reset(
reinterpret_cast<rocksdb::TableFactory*>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->allow_mmap_reads =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->allow_mmap_writes =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->is_fd_close_on_exec =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->skip_log_error_on_recovery =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->stats_dump_period_sec =
static_cast<int>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->advise_random_on_open =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->use_adaptive_mutex =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->bytes_per_sync =
static_cast<int64_t>(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<rocksdb::Options*>(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<rocksdb::Options*>(jhandle)->allow_thread_local =
static_cast<bool>(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<rocksdb::Options*>(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<rocksdb::WriteOptions*>(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<rocksdb::WriteOptions*>(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<rocksdb::WriteOptions*>(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<rocksdb::WriteOptions*>(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<rocksdb::WriteOptions*>(jhandle)->disableWAL;
}