|
|
@ -148,32 +148,25 @@ jobject Java_org_rocksdb_RestoreBackupableDB_getBackupInfo( |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RestoreBackupableDB |
|
|
|
* Class: org_rocksdb_RestoreBackupableDB |
|
|
|
* Method: getCorruptedBackups |
|
|
|
* Method: getCorruptedBackups |
|
|
|
* Signature: (J)Ljava/util/List; |
|
|
|
* Signature: (J)[I; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
jobject Java_org_rocksdb_RestoreBackupableDB_getCorruptedBackups( |
|
|
|
jintArray Java_org_rocksdb_RestoreBackupableDB_getCorruptedBackups( |
|
|
|
JNIEnv* env, jobject jbdb, jlong jhandle) { |
|
|
|
JNIEnv* env, jobject jbdb, jlong jhandle) { |
|
|
|
std::vector<rocksdb::BackupID> backup_ids; |
|
|
|
std::vector<rocksdb::BackupID> backup_ids; |
|
|
|
reinterpret_cast<rocksdb::RestoreBackupableDB*>(jhandle)-> |
|
|
|
reinterpret_cast<rocksdb::RestoreBackupableDB*>(jhandle)-> |
|
|
|
GetCorruptedBackups(&backup_ids); |
|
|
|
GetCorruptedBackups(&backup_ids); |
|
|
|
|
|
|
|
// store backupids in int array
|
|
|
|
jclass jclazz = env->FindClass("java/util/ArrayList"); |
|
|
|
const int kIdSize = backup_ids.size(); |
|
|
|
jmethodID mid = rocksdb::ListJni::getArrayListConstructorMethodId( |
|
|
|
int int_backup_ids[kIdSize]; |
|
|
|
env, jclazz); |
|
|
|
|
|
|
|
jobject jbackup_id_handle_list = env->NewObject(jclazz, mid, |
|
|
|
|
|
|
|
backup_ids.size()); |
|
|
|
|
|
|
|
// insert in java list
|
|
|
|
|
|
|
|
for (std::vector<rocksdb::BackupID>::size_type i = 0; |
|
|
|
for (std::vector<rocksdb::BackupID>::size_type i = 0; |
|
|
|
i != backup_ids.size(); i++) { |
|
|
|
i != backup_ids.size(); i++) { |
|
|
|
// convert BackupID to Integer
|
|
|
|
int_backup_ids[i] = backup_ids[i]; |
|
|
|
jclass jIntClazz = env->FindClass("java/lang/Integer"); |
|
|
|
|
|
|
|
jmethodID midLong = env->GetMethodID(jIntClazz, "<init>", "(I)V"); |
|
|
|
|
|
|
|
jobject obj = env->NewObject(jIntClazz, midLong, |
|
|
|
|
|
|
|
(backup_ids[i])); |
|
|
|
|
|
|
|
// add Integer to List
|
|
|
|
|
|
|
|
env->CallBooleanMethod(jbackup_id_handle_list, |
|
|
|
|
|
|
|
rocksdb::ListJni::getListAddMethodId(env), obj); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return jbackup_id_handle_list; |
|
|
|
// Store ints in java array
|
|
|
|
|
|
|
|
jintArray ret_backup_ids; |
|
|
|
|
|
|
|
ret_backup_ids = env->NewIntArray(kIdSize); |
|
|
|
|
|
|
|
env->SetIntArrayRegion(ret_backup_ids, 0, kIdSize, int_backup_ids); |
|
|
|
|
|
|
|
return ret_backup_ids; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|