2016-02-09 23:12:00 +00:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2014-05-14 05:20:58 +00:00
|
|
|
// 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++ and enables
|
2014-05-19 05:40:48 +00:00
|
|
|
// calling c++ rocksdb::RestoreBackupableDB and rocksdb::RestoreOptions methods
|
2014-05-14 05:20:58 +00:00
|
|
|
// from Java side.
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <jni.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "include/org_rocksdb_RestoreOptions.h"
|
|
|
|
#include "rocksjni/portal.h"
|
2014-07-23 18:15:14 +00:00
|
|
|
#include "rocksdb/utilities/backupable_db.h"
|
2014-05-14 05:20:58 +00:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RestoreOptions
|
|
|
|
* Method: newRestoreOptions
|
2014-05-19 05:40:48 +00:00
|
|
|
* Signature: (Z)J
|
2014-05-14 05:20:58 +00:00
|
|
|
*/
|
2014-05-19 05:40:48 +00:00
|
|
|
jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions(JNIEnv* env,
|
2016-01-20 17:05:41 +00:00
|
|
|
jclass jcls, jboolean keep_log_files) {
|
2017-02-28 00:26:12 +00:00
|
|
|
auto* ropt = new rocksdb::RestoreOptions(keep_log_files);
|
2014-05-19 05:40:48 +00:00
|
|
|
return reinterpret_cast<jlong>(ropt);
|
2014-05-14 05:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RestoreOptions
|
2016-01-20 17:05:41 +00:00
|
|
|
* Method: disposeInternal
|
2014-05-14 05:20:58 +00:00
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2016-01-20 17:05:41 +00:00
|
|
|
void Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv* env, jobject jobj,
|
2014-05-14 05:20:58 +00:00
|
|
|
jlong jhandle) {
|
2017-02-28 00:26:12 +00:00
|
|
|
auto* ropt = reinterpret_cast<rocksdb::RestoreOptions*>(jhandle);
|
2014-05-14 05:20:58 +00:00
|
|
|
assert(ropt);
|
|
|
|
delete ropt;
|
|
|
|
}
|