restorejni.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include <jni.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string>
  13. #include "include/org_rocksdb_RestoreOptions.h"
  14. #include "rocksdb/utilities/backupable_db.h"
  15. #include "rocksjni/portal.h"
  16. /*
  17. * Class: org_rocksdb_RestoreOptions
  18. * Method: newRestoreOptions
  19. * Signature: (Z)J
  20. */
  21. jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions(
  22. JNIEnv* /*env*/, jclass /*jcls*/, jboolean keep_log_files) {
  23. auto* ropt = new ROCKSDB_NAMESPACE::RestoreOptions(keep_log_files);
  24. return reinterpret_cast<jlong>(ropt);
  25. }
  26. /*
  27. * Class: org_rocksdb_RestoreOptions
  28. * Method: disposeInternal
  29. * Signature: (J)V
  30. */
  31. void Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv* /*env*/,
  32. jobject /*jobj*/,
  33. jlong jhandle) {
  34. auto* ropt = reinterpret_cast<ROCKSDB_NAMESPACE::RestoreOptions*>(jhandle);
  35. assert(ropt);
  36. delete ropt;
  37. }