Refactor filter impl

main
Ankit Gupta 11 years ago
parent 5e797cf0dd
commit 677b0d6d3f
  1. 6
      java/org/rocksdb/Filter.java
  2. 4
      java/org/rocksdb/Options.java
  3. 4
      java/rocksjni/options.cc

@ -12,7 +12,7 @@ package org.rocksdb;
* number of disk seeks form a handful to a single disk seek per * number of disk seeks form a handful to a single disk seek per
* DB::Get() call. * DB::Get() call.
* *
* This function a new filter policy that uses a bloom filter * This class creates a new filter policy that uses a bloom filter
* with approximately the specified number of bits per key. * with approximately the specified number of bits per key.
* A good value for bitsPerKey is 10, which yields a filter * A good value for bitsPerKey is 10, which yields a filter
* with ~ 1% false positive rate. * with ~ 1% false positive rate.
@ -24,10 +24,6 @@ public class Filter {
newFilter(bitsPerKey); newFilter(bitsPerKey);
} }
public long getNativeHandle() {
return nativeHandle_;
}
/** /**
* Deletes underlying C++ filter pointer. * Deletes underlying C++ filter pointer.
*/ */

@ -152,7 +152,7 @@ public class Options {
*/ */
public Options setFilter(Filter filter) { public Options setFilter(Filter filter) {
assert(isInitialized()); assert(isInitialized());
setFilter0(nativeHandle_, filter.getNativeHandle()); setFilter0(nativeHandle_, filter);
return this; return this;
} }
@ -1250,7 +1250,7 @@ public class Options {
private native void useFixedLengthPrefixExtractor( private native void useFixedLengthPrefixExtractor(
long handle, int prefixLength); long handle, int prefixLength);
private native void setFilter0(long optHandle, long fpHandle); private native void setFilter0(long optHandle, Filter fp);
long nativeHandle_; long nativeHandle_;
long cacheSize_; long cacheSize_;

@ -126,9 +126,9 @@ jlong Java_org_rocksdb_Options_statisticsPtr(
* Signature: (JJ)V * Signature: (JJ)V
*/ */
void Java_org_rocksdb_Options_setFilter0( void Java_org_rocksdb_Options_setFilter0(
JNIEnv* env, jobject jobj, jlong jopt_handle, jlong jfp_handle) { JNIEnv* env, jobject jobj, jlong jopt_handle, jobject jfp) {
reinterpret_cast<rocksdb::Options*>(jopt_handle)->filter_policy = reinterpret_cast<rocksdb::Options*>(jopt_handle)->filter_policy =
reinterpret_cast<rocksdb::FilterPolicy*>(jfp_handle); rocksdb::FilterJni::getHandle(env, jfp);
} }
/* /*

Loading…
Cancel
Save