[Java] Rename org.rocksdb.Iterator to org.rocksdb.RocksIterator.
Summary: Renamed Iterator to RocksIterator to avoid potential confliction with the Java built-in Iterator. Test Plan: make rocksdbjava make jtest Reviewers: haobo, dhruba, sdong, ankgup87 Reviewed By: sdong CC: leveldb, rsumbaly, swapnilghike, zzbennett Differential Revision: https://reviews.facebook.net/D18615
This commit is contained in:
parent
3f8da15bf9
commit
d14581f936
@ -1,4 +1,4 @@
|
||||
NATIVE_JAVA_CLASSES = org.rocksdb.RocksDB org.rocksdb.Options org.rocksdb.WriteBatch org.rocksdb.WriteBatchInternal org.rocksdb.WriteBatchTest org.rocksdb.WriteOptions org.rocksdb.BackupableDB org.rocksdb.BackupableDBOptions org.rocksdb.Statistics org.rocksdb.Iterator org.rocksdb.VectorMemTableConfig org.rocksdb.SkipListMemTableConfig org.rocksdb.HashLinkedListMemTableConfig org.rocksdb.HashSkipListMemTableConfig org.rocksdb.PlainTableConfig org.rocksdb.ReadOptions org.rocksdb.Filter org.rocksdb.BloomFilter
|
||||
NATIVE_JAVA_CLASSES = org.rocksdb.RocksDB org.rocksdb.Options org.rocksdb.WriteBatch org.rocksdb.WriteBatchInternal org.rocksdb.WriteBatchTest org.rocksdb.WriteOptions org.rocksdb.BackupableDB org.rocksdb.BackupableDBOptions org.rocksdb.Statistics org.rocksdb.RocksIterator org.rocksdb.VectorMemTableConfig org.rocksdb.SkipListMemTableConfig org.rocksdb.HashLinkedListMemTableConfig org.rocksdb.HashSkipListMemTableConfig org.rocksdb.PlainTableConfig org.rocksdb.ReadOptions org.rocksdb.Filter org.rocksdb.BloomFilter
|
||||
NATIVE_INCLUDE = ./include
|
||||
ROCKSDB_JAR = rocksdbjni.jar
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class RocksDBSample {
|
||||
assert(false); //Should never reach here.
|
||||
}
|
||||
|
||||
Iterator iterator = db.newIterator();
|
||||
RocksIterator iterator = db.newIterator();
|
||||
|
||||
boolean seekToFirstPassed = false;
|
||||
for (iterator.seekToFirst(); iterator.isValid(); iterator.next()) {
|
||||
|
@ -311,8 +311,8 @@ public class RocksDB extends RocksObject {
|
||||
*
|
||||
* @return instance of iterator object.
|
||||
*/
|
||||
public Iterator newIterator() {
|
||||
return new Iterator(iterator0(nativeHandle_));
|
||||
public RocksIterator newIterator() {
|
||||
return new RocksIterator(iterator0(nativeHandle_));
|
||||
}
|
||||
|
||||
@Override protected void finalize() {
|
||||
|
@ -11,13 +11,13 @@ package org.rocksdb;
|
||||
* are provided by this library. In particular, iterators are provided
|
||||
* to access the contents of a Table or a DB.
|
||||
*
|
||||
* Multiple threads can invoke const methods on an Iterator without
|
||||
* Multiple threads can invoke const methods on an RocksIterator without
|
||||
* external synchronization, but if any of the threads may call a
|
||||
* non-const method, all threads accessing the same Iterator must use
|
||||
* non-const method, all threads accessing the same RocksIterator must use
|
||||
* external synchronization.
|
||||
*/
|
||||
public class Iterator extends RocksObject {
|
||||
public Iterator(long nativeHandle) {
|
||||
public class RocksIterator extends RocksObject {
|
||||
public RocksIterator(long nativeHandle) {
|
||||
super();
|
||||
nativeHandle_ = nativeHandle;
|
||||
}
|
@ -416,7 +416,7 @@ public class DbBenchmark {
|
||||
super(tid, randSeed, numEntries, keyRange);
|
||||
}
|
||||
@Override public void runTask() throws RocksDBException {
|
||||
org.rocksdb.Iterator iter = db_.newIterator();
|
||||
RocksIterator iter = db_.newIterator();
|
||||
long i;
|
||||
for (iter.seekToFirst(), i = 0;
|
||||
iter.isValid() && i < numEntries_;
|
||||
|
@ -10,66 +10,66 @@
|
||||
#include <stdlib.h>
|
||||
#include <jni.h>
|
||||
|
||||
#include "include/org_rocksdb_Iterator.h"
|
||||
#include "include/org_rocksdb_RocksIterator.h"
|
||||
#include "rocksjni/portal.h"
|
||||
#include "rocksdb/iterator.h"
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: isValid0
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
jboolean Java_org_rocksdb_Iterator_isValid0(
|
||||
jboolean Java_org_rocksdb_RocksIterator_isValid0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
return reinterpret_cast<rocksdb::Iterator*>(handle)->Valid();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: seekToFirst0
|
||||
* Signature: (J)V
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_seekToFirst0(
|
||||
void Java_org_rocksdb_RocksIterator_seekToFirst0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
reinterpret_cast<rocksdb::Iterator*>(handle)->SeekToFirst();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: seekToFirst0
|
||||
* Signature: (J)V
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_seekToLast0(
|
||||
void Java_org_rocksdb_RocksIterator_seekToLast0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
reinterpret_cast<rocksdb::Iterator*>(handle)->SeekToLast();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: seekToLast0
|
||||
* Signature: (J)V
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_next0(
|
||||
void Java_org_rocksdb_RocksIterator_next0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
reinterpret_cast<rocksdb::Iterator*>(handle)->Next();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: next0
|
||||
* Signature: (J)V
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_prev0(
|
||||
void Java_org_rocksdb_RocksIterator_prev0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
reinterpret_cast<rocksdb::Iterator*>(handle)->Prev();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: prev0
|
||||
* Signature: (J)V
|
||||
*/
|
||||
jbyteArray Java_org_rocksdb_Iterator_key0(
|
||||
jbyteArray Java_org_rocksdb_RocksIterator_key0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
auto it = reinterpret_cast<rocksdb::Iterator*>(handle);
|
||||
rocksdb::Slice key_slice = it->key();
|
||||
@ -82,11 +82,11 @@ jbyteArray Java_org_rocksdb_Iterator_key0(
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: key0
|
||||
* Signature: (J)[B
|
||||
*/
|
||||
jbyteArray Java_org_rocksdb_Iterator_value0(
|
||||
jbyteArray Java_org_rocksdb_RocksIterator_value0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
auto it = reinterpret_cast<rocksdb::Iterator*>(handle);
|
||||
rocksdb::Slice value_slice = it->value();
|
||||
@ -99,11 +99,11 @@ jbyteArray Java_org_rocksdb_Iterator_value0(
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: value0
|
||||
* Signature: (J)[B
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_seek0(
|
||||
void Java_org_rocksdb_RocksIterator_seek0(
|
||||
JNIEnv* env, jobject jobj, jlong handle,
|
||||
jbyteArray jtarget, jint jtarget_len) {
|
||||
auto it = reinterpret_cast<rocksdb::Iterator*>(handle);
|
||||
@ -117,11 +117,11 @@ void Java_org_rocksdb_Iterator_seek0(
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: seek0
|
||||
* Signature: (J[BI)V
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_status0(
|
||||
void Java_org_rocksdb_RocksIterator_status0(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
auto it = reinterpret_cast<rocksdb::Iterator*>(handle);
|
||||
rocksdb::Status s = it->status();
|
||||
@ -134,11 +134,11 @@ void Java_org_rocksdb_Iterator_status0(
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_Iterator
|
||||
* Class: org_rocksdb_RocksIterator
|
||||
* Method: dispose
|
||||
* Signature: (J)V
|
||||
*/
|
||||
void Java_org_rocksdb_Iterator_dispose(
|
||||
void Java_org_rocksdb_RocksIterator_dispose(
|
||||
JNIEnv* env, jobject jobj, jlong handle) {
|
||||
auto it = reinterpret_cast<rocksdb::Iterator*>(handle);
|
||||
delete it;
|
||||
|
@ -254,7 +254,7 @@ class IteratorJni {
|
||||
public:
|
||||
// Get the java class id of org.rocksdb.Iteartor.
|
||||
static jclass getJClass(JNIEnv* env) {
|
||||
static jclass jclazz = env->FindClass("org/rocksdb/Iterator");
|
||||
static jclass jclazz = env->FindClass("org/rocksdb/RocksIterator");
|
||||
assert(jclazz != nullptr);
|
||||
return jclazz;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user