2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// 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).
|
2014-04-18 02:28:51 +02:00
|
|
|
//
|
|
|
|
// This file implements the "bridge" between Java and C++ and enables
|
2020-02-20 21:07:53 +01:00
|
|
|
// calling c++ ROCKSDB_NAMESPACE::BackupEnginge and
|
2022-01-28 00:44:23 +01:00
|
|
|
// ROCKSDB_NAMESPACE::BackupEngineOptions methods from Java side.
|
2014-04-18 02:28:51 +02:00
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
#include <jni.h>
|
2014-04-18 02:28:51 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2022-01-28 00:44:23 +01:00
|
|
|
|
2014-04-18 02:28:51 +02:00
|
|
|
#include <string>
|
2014-10-26 23:23:06 +01:00
|
|
|
#include <vector>
|
2014-04-18 02:28:51 +02:00
|
|
|
|
2022-01-28 00:44:23 +01:00
|
|
|
#include "include/org_rocksdb_BackupEngineOptions.h"
|
|
|
|
#include "rocksdb/utilities/backup_engine.h"
|
2018-04-13 02:55:14 +02:00
|
|
|
#include "rocksjni/portal.h"
|
2014-04-18 02:28:51 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// BackupDBOptions
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
|
|
|
* Method: newBackupEngineOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: (Ljava/lang/String;)J
|
2014-04-18 02:28:51 +02:00
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jlong Java_org_rocksdb_BackupEngineOptions_newBackupEngineOptions(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* env, jclass /*jcls*/, jstring jpath) {
|
2017-02-28 01:26:12 +01:00
|
|
|
const char* cpath = env->GetStringUTFChars(jpath, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (cpath == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return 0;
|
|
|
|
}
|
2022-01-28 00:44:23 +01:00
|
|
|
auto* bopt = new ROCKSDB_NAMESPACE::BackupEngineOptions(cpath);
|
2014-04-18 02:28:51 +02:00
|
|
|
env->ReleaseStringUTFChars(jpath, cpath);
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(bopt);
|
2014-04-18 02:28:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-04-18 02:28:51 +02:00
|
|
|
* Method: backupDir
|
|
|
|
* Signature: (J)Ljava/lang/String;
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jstring Java_org_rocksdb_BackupEngineOptions_backupDir(JNIEnv* env,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jopt*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-04-18 02:28:51 +02:00
|
|
|
return env->NewStringUTF(bopt->backup_dir.c_str());
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setBackupEnv
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setBackupEnv(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jopt*/, jlong jhandle, jlong jrocks_env_handle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* rocks_env =
|
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(jrocks_env_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
bopt->backup_env = rocks_env;
|
|
|
|
}
|
|
|
|
|
2014-11-15 23:03:32 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-15 23:03:32 +01:00
|
|
|
* Method: setShareTableFiles
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setShareTableFiles(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jboolean flag) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-15 23:03:32 +01:00
|
|
|
bopt->share_table_files = flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-15 23:03:32 +01:00
|
|
|
* Method: shareTableFiles
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jboolean Java_org_rocksdb_BackupEngineOptions_shareTableFiles(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-15 23:03:32 +01:00
|
|
|
return bopt->share_table_files;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setInfoLog
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setInfoLog(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jlong /*jlogger_handle*/) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* sptr_logger =
|
2020-02-20 21:07:53 +01:00
|
|
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::LoggerJniCallback>*>(
|
|
|
|
jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
bopt->info_log = sptr_logger->get();
|
|
|
|
}
|
|
|
|
|
2014-11-15 23:03:32 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-15 23:03:32 +01:00
|
|
|
* Method: setSync
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setSync(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jboolean flag) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-15 23:03:32 +01:00
|
|
|
bopt->sync = flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-15 23:03:32 +01:00
|
|
|
* Method: sync
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jboolean Java_org_rocksdb_BackupEngineOptions_sync(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-15 23:03:32 +01:00
|
|
|
return bopt->sync;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: setDestroyOldData
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setDestroyOldData(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jboolean flag) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
bopt->destroy_old_data = flag;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: destroyOldData
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jboolean Java_org_rocksdb_BackupEngineOptions_destroyOldData(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
return bopt->destroy_old_data;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: setBackupLogFiles
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setBackupLogFiles(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle,
|
|
|
|
jboolean flag) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
bopt->backup_log_files = flag;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: backupLogFiles
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jboolean Java_org_rocksdb_BackupEngineOptions_backupLogFiles(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
return bopt->backup_log_files;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: setBackupRateLimit
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setBackupRateLimit(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jlong jbackup_rate_limit) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
bopt->backup_rate_limit = jbackup_rate_limit;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: backupRateLimit
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jlong Java_org_rocksdb_BackupEngineOptions_backupRateLimit(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
return bopt->backup_rate_limit;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setBackupRateLimiter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setBackupRateLimiter(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jlong jrate_limiter_handle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* sptr_rate_limiter =
|
2020-02-20 21:07:53 +01:00
|
|
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
|
2018-04-13 02:55:14 +02:00
|
|
|
jrate_limiter_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
bopt->backup_rate_limiter = *sptr_rate_limiter;
|
|
|
|
}
|
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: setRestoreRateLimit
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setRestoreRateLimit(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jlong jrestore_rate_limit) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
bopt->restore_rate_limit = jrestore_rate_limit;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: restoreRateLimit
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jlong Java_org_rocksdb_BackupEngineOptions_restoreRateLimit(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jobj*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
return bopt->restore_rate_limit;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setRestoreRateLimiter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setRestoreRateLimiter(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jlong jrate_limiter_handle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* sptr_rate_limiter =
|
2020-02-20 21:07:53 +01:00
|
|
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
|
2018-04-13 02:55:14 +02:00
|
|
|
jrate_limiter_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
bopt->restore_rate_limiter = *sptr_rate_limiter;
|
|
|
|
}
|
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: setShareFilesWithChecksum
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setShareFilesWithChecksum(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
bopt->share_files_with_checksum = flag;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2014-11-16 14:52:53 +01:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2014-11-16 14:52:53 +01:00
|
|
|
* Method: shareFilesWithChecksum
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jboolean Java_org_rocksdb_BackupEngineOptions_shareFilesWithChecksum(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2014-11-16 14:52:53 +01:00
|
|
|
return bopt->share_files_with_checksum;
|
|
|
|
}
|
2014-11-15 23:03:32 +01:00
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setMaxBackgroundOperations
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setMaxBackgroundOperations(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
|
|
|
jint max_background_operations) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
bopt->max_background_operations = static_cast<int>(max_background_operations);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: maxBackgroundOperations
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jint Java_org_rocksdb_BackupEngineOptions_maxBackgroundOperations(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jint>(bopt->max_background_operations);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setCallbackTriggerIntervalSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_setCallbackTriggerIntervalSize(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jlong jcallback_trigger_interval_size) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
bopt->callback_trigger_interval_size =
|
|
|
|
static_cast<uint64_t>(jcallback_trigger_interval_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: callbackTriggerIntervalSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
jlong Java_org_rocksdb_BackupEngineOptions_callbackTriggerIntervalSize(
|
2018-04-13 02:55:14 +02:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
return static_cast<jlong>(bopt->callback_trigger_interval_size);
|
|
|
|
}
|
|
|
|
|
2014-04-18 02:28:51 +02:00
|
|
|
/*
|
2022-01-28 00:44:23 +01:00
|
|
|
* Class: org_rocksdb_BackupEngineOptions
|
[Java] Generalize dis-own native handle and refine dispose framework.
Summary:
1. Move disOwnNativeHandle() function from RocksDB to RocksObject
to allow other RocksObject to use disOwnNativeHandle() when its
ownership of native handle has been transferred.
2. RocksObject now has an abstract implementation of dispose(),
which does the following two things. First, it checks whether
both isOwningNativeHandle() and isInitialized() return true.
If so, it will call the protected abstract function dispose0(),
which all the subclasses of RocksObject should implement. Second,
it sets nativeHandle_ = 0. This redesign ensure all subclasses
of RocksObject have the same dispose behavior.
3. All subclasses of RocksObject now should implement dispose0()
instead of dispose(), and dispose0() will be called only when
isInitialized() returns true.
Test Plan:
make rocksdbjava
make jtest
Reviewers: dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett, haobo
Reviewed By: haobo
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D18801
2014-05-29 03:16:29 +02:00
|
|
|
* Method: disposeInternal
|
2014-04-18 02:28:51 +02:00
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2022-01-28 00:44:23 +01:00
|
|
|
void Java_org_rocksdb_BackupEngineOptions_disposeInternal(JNIEnv* /*env*/,
|
2018-04-13 02:55:14 +02:00
|
|
|
jobject /*jopt*/,
|
|
|
|
jlong jhandle) {
|
2020-02-20 21:07:53 +01:00
|
|
|
auto* bopt =
|
2022-01-28 00:44:23 +01:00
|
|
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
2017-02-28 01:26:12 +01:00
|
|
|
assert(bopt != nullptr);
|
2014-04-18 02:28:51 +02:00
|
|
|
delete bopt;
|
|
|
|
}
|