1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5 //
6 // This file implements the "bridge" between Java and C++ and enables
7 // calling C++ ROCKSDB_NAMESPACE::RestoreOptions methods
8 // from Java side.
9
10 #include <jni.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string>
14
15 #include "include/org_rocksdb_RestoreOptions.h"
16 #include "rocksdb/utilities/backupable_db.h"
17 #include "rocksjni/portal.h"
18 /*
19 * Class: org_rocksdb_RestoreOptions
20 * Method: newRestoreOptions
21 * Signature: (Z)J
22 */
Java_org_rocksdb_RestoreOptions_newRestoreOptions(JNIEnv *,jclass,jboolean keep_log_files)23 jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions(
24 JNIEnv* /*env*/, jclass /*jcls*/, jboolean keep_log_files) {
25 auto* ropt = new ROCKSDB_NAMESPACE::RestoreOptions(keep_log_files);
26 return reinterpret_cast<jlong>(ropt);
27 }
28
29 /*
30 * Class: org_rocksdb_RestoreOptions
31 * Method: disposeInternal
32 * Signature: (J)V
33 */
Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv *,jobject,jlong jhandle)34 void Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv* /*env*/,
35 jobject /*jobj*/,
36 jlong jhandle) {
37 auto* ropt = reinterpret_cast<ROCKSDB_NAMESPACE::RestoreOptions*>(jhandle);
38 assert(ropt);
39 delete ropt;
40 }
41