rocksdb/java/rocksjni/import_column_family_options.cc
马越 19768a923a Add jni Support for API CreateColumnFamilyWithImport (#11646)
Summary:
- Add the following missing options to src/main/java/org/rocksdb/ImportColumnFamilyOptions.java and in java/rocksjni/import_column_family_options.cc in RocksJava.
- Add the struct to src/main/java/org/rocksdb/ExportImportFilesMetaData.java and in java/rocksjni/export_import_files_metadatajni.cc in RocksJava.
- Add New Java API `createColumnFamilyWithImport` to src/main/java/org/rocksdb/RocksDB.java
- Add New Java API `exportColumnFamily` to src/main/java/org/rocksdb/Checkpoint.java

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11646

Test Plan:
- added unit tests for exportColumnFamily in org.rocksdb.CheckpointTest
- added unit tests for createColumnFamilyWithImport to org.rocksdb.ImportColumnFamilyTest

Reviewed By: ajkr

Differential Revision: D50889700

Pulled By: cbi42

fbshipit-source-id: d623b35e445bba62a0d3c007d74352e937678f6c
2023-11-06 07:38:42 -08:00

59 lines
2 KiB
C++

// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#include <jni.h>
#include "include/org_rocksdb_ImportColumnFamilyOptions.h"
#include "rocksdb/options.h"
#include "rocksjni/cplusplus_to_java_convert.h"
/*
* Class: org_rocksdb_ImportColumnFamilyOptions
* Method: newImportColumnFamilyOptions
* Signature: ()J
*/
jlong Java_org_rocksdb_ImportColumnFamilyOptions_newImportColumnFamilyOptions(
JNIEnv *, jclass) {
ROCKSDB_NAMESPACE::ImportColumnFamilyOptions *opts =
new ROCKSDB_NAMESPACE::ImportColumnFamilyOptions();
return GET_CPLUSPLUS_POINTER(opts);
}
/*
* Class: org_rocksdb_ImportColumnFamilyOptions
* Method: setMoveFiles
* Signature: (JZ)V
*/
void Java_org_rocksdb_ImportColumnFamilyOptions_setMoveFiles(
JNIEnv *, jobject, jlong jhandle, jboolean jmove_files) {
auto *options =
reinterpret_cast<ROCKSDB_NAMESPACE::ImportColumnFamilyOptions *>(jhandle);
options->move_files = static_cast<bool>(jmove_files);
}
/*
* Class: org_rocksdb_ImportColumnFamilyOptions
* Method: moveFiles
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_ImportColumnFamilyOptions_moveFiles(JNIEnv *, jobject,
jlong jhandle) {
auto *options =
reinterpret_cast<ROCKSDB_NAMESPACE::ImportColumnFamilyOptions *>(jhandle);
return static_cast<jboolean>(options->move_files);
}
/*
* Class: org_rocksdb_ImportColumnFamilyOptions
* Method: disposeInternal
* Signature: (J)V
*/
void Java_org_rocksdb_ImportColumnFamilyOptions_disposeInternal(JNIEnv *,
jobject,
jlong jhandle) {
delete reinterpret_cast<ROCKSDB_NAMESPACE::ImportColumnFamilyOptions *>(
jhandle);
}