]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/rocksjni/restorejni.cc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / rocksjni / restorejni.cc
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5 //
6 // This file implements the "bridge" between Java and C++ and enables
7 // calling c++ rocksdb::RestoreBackupableDB and rocksdb::RestoreOptions methods
8 // from Java side.
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <jni.h>
13 #include <string>
14
15 #include "include/org_rocksdb_RestoreOptions.h"
16 #include "rocksjni/portal.h"
17 #include "rocksdb/utilities/backupable_db.h"
18 /*
19 * Class: org_rocksdb_RestoreOptions
20 * Method: newRestoreOptions
21 * Signature: (Z)J
22 */
23 jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions(JNIEnv* env,
24 jclass jcls, jboolean keep_log_files) {
25 auto* ropt = new rocksdb::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 */
34 void Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv* env, jobject jobj,
35 jlong jhandle) {
36 auto* ropt = reinterpret_cast<rocksdb::RestoreOptions*>(jhandle);
37 assert(ropt);
38 delete ropt;
39 }