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