restorejni.cc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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/backup_engine.h"
  15. #include "rocksjni/cplusplus_to_java_convert.h"
  16. #include "rocksjni/portal.h"
  17. /*
  18. * Class: org_rocksdb_RestoreOptions
  19. * Method: newRestoreOptions
  20. * Signature: (Z)J
  21. */
  22. jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions(
  23. JNIEnv* /*env*/, jclass /*jcls*/, jboolean keep_log_files) {
  24. auto* ropt = new ROCKSDB_NAMESPACE::RestoreOptions(keep_log_files);
  25. return GET_CPLUSPLUS_POINTER(ropt);
  26. }
  27. /*
  28. * Class: org_rocksdb_RestoreOptions
  29. * Method: disposeInternal
  30. * Signature: (J)V
  31. */
  32. void Java_org_rocksdb_RestoreOptions_disposeInternalJni(JNIEnv* /*env*/,
  33. jclass /*jobj*/,
  34. jlong jhandle) {
  35. auto* ropt = reinterpret_cast<ROCKSDB_NAMESPACE::RestoreOptions*>(jhandle);
  36. assert(ropt);
  37. delete ropt;
  38. }