-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support flink_value_extractor_factory jni #220
- Loading branch information
Showing
6 changed files
with
124 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. | ||
// 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). | ||
// | ||
// This file implements the "bridge" between Java and C++ for | ||
// TERARKDB_NAMESPACE::CompactionFilter. | ||
|
||
#include "rocksdb/value_extractor.h" | ||
|
||
#include <jni.h> | ||
|
||
#include "include/org_rocksdb_AbstractValueExtractorFactory.h" | ||
|
||
// <editor-fold desc="org.rocksdb.AbstractCompactionFilter"> | ||
|
||
/* | ||
* Class: org_rocksdb_AbstractCompactionFilter | ||
* Method: disposeInternal | ||
* Signature: (J)V | ||
*/ | ||
void Java_org_rocksdb_AbstractValueExtractorFactory_disposeInternal( | ||
JNIEnv* /*env*/, jobject /*jobj*/, jlong handle) { | ||
auto* vef = | ||
reinterpret_cast<TERARKDB_NAMESPACE::ValueExtractorFactory*>(handle); | ||
assert(vef != nullptr); | ||
delete vef; | ||
} | ||
// </editor-fold> |
40 changes: 40 additions & 0 deletions
40
java/src/main/java/org/rocksdb/AbstractValueExtractoFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. | ||
// 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). | ||
|
||
package org.rocksdb; | ||
|
||
/** | ||
* Each compaction will create a new {@link AbstractCompactionFilter} | ||
* allowing the application to know about different compactions | ||
* | ||
* @param <T> The concrete type of the compaction filter | ||
*/ | ||
public abstract class AbstractValueExtractorFactory<T extends AbstractSlice<?>> | ||
extends RocksObject { | ||
|
||
public AbstractValueExtractorFactory(final long nativeHandle) { | ||
super(nativeHandle); | ||
} | ||
|
||
|
||
/** | ||
* A name which identifies this compaction filter | ||
* | ||
* The name will be printed to the LOG file on start up for diagnosis | ||
*/ | ||
public abstract String name(); | ||
|
||
/** | ||
* We override {@link RocksCallbackObject#disposeInternal()} | ||
* as disposing of a TERARKDB_NAMESPACE::AbstractCompactionFilterFactory requires | ||
* a slightly different approach as it is a std::shared_ptr | ||
*/ | ||
@Override | ||
protected void disposeInternal() { | ||
disposeInternal(nativeHandle_); | ||
} | ||
|
||
private native void disposeInternal(final long handle); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters