2018-03-02 18:22:38 +00:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
//
|
|
|
|
// This file implements the "bridge" between Java and C++
|
2020-02-20 20:07:53 +00:00
|
|
|
// for ROCKSDB_NAMESPACE::TransactionOptions.
|
2018-03-02 18:22:38 +00:00
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
#include "include/org_rocksdb_TransactionOptions.h"
|
|
|
|
|
|
|
|
#include "rocksdb/utilities/transaction_db.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: newTransactionOptions
|
|
|
|
* Signature: ()J
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
jlong Java_org_rocksdb_TransactionOptions_newTransactionOptions(
|
|
|
|
JNIEnv* /*env*/, jclass /*jcls*/) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts = new ROCKSDB_NAMESPACE::TransactionOptions();
|
2018-03-02 18:22:38 +00:00
|
|
|
return reinterpret_cast<jlong>(opts);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: isSetSnapshot
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
jboolean Java_org_rocksdb_TransactionOptions_isSetSnapshot(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
return opts->set_snapshot;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: setSetSnapshot
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_setSetSnapshot(
|
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean jset_snapshot) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
opts->set_snapshot = jset_snapshot;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: isDeadlockDetect
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
jboolean Java_org_rocksdb_TransactionOptions_isDeadlockDetect(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
return opts->deadlock_detect;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2018-04-13 00:55:14 +00:00
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: setDeadlockDetect
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2018-03-02 18:22:38 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_setDeadlockDetect(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jboolean jdeadlock_detect) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
opts->deadlock_detect = jdeadlock_detect;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: getLockTimeout
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
jlong Java_org_rocksdb_TransactionOptions_getLockTimeout(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
return opts->lock_timeout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: setLockTimeout
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_setLockTimeout(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jlong jlock_timeout) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
opts->lock_timeout = jlock_timeout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: getExpiration
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
jlong Java_org_rocksdb_TransactionOptions_getExpiration(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
return opts->expiration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: setExpiration
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_setExpiration(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jlong jexpiration) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
opts->expiration = jexpiration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: getDeadlockDetectDepth
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_TransactionOptions_getDeadlockDetectDepth(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
return opts->deadlock_detect_depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2018-04-13 00:55:14 +00:00
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: setDeadlockDetectDepth
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2018-03-02 18:22:38 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_setDeadlockDetectDepth(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jlong jdeadlock_detect_depth) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
opts->deadlock_detect_depth = jdeadlock_detect_depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2018-04-13 00:55:14 +00:00
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: getMaxWriteBatchSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_TransactionOptions_getMaxWriteBatchSize(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
return opts->max_write_batch_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2018-04-13 00:55:14 +00:00
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: setMaxWriteBatchSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2018-03-02 18:22:38 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_setMaxWriteBatchSize(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jlong jmax_write_batch_size) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* opts =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
opts->max_write_batch_size = jmax_write_batch_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_TransactionOptions
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2018-04-13 00:55:14 +00:00
|
|
|
void Java_org_rocksdb_TransactionOptions_disposeInternal(JNIEnv* /*env*/,
|
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 20:07:53 +00:00
|
|
|
delete reinterpret_cast<ROCKSDB_NAMESPACE::TransactionOptions*>(jhandle);
|
2018-03-02 18:22:38 +00:00
|
|
|
}
|