2017-07-28 20:55:19 +00:00
|
|
|
// Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
|
2017-07-15 23:03:42 +00:00
|
|
|
// 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).
|
2017-06-16 21:12:52 +00:00
|
|
|
|
2018-04-13 00:55:14 +00:00
|
|
|
#include <jni.h>
|
2017-06-16 21:12:52 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2022-03-01 17:02:15 +00:00
|
|
|
|
2017-06-16 21:12:52 +00:00
|
|
|
#include <memory>
|
2018-04-13 00:55:14 +00:00
|
|
|
#include <string>
|
2017-06-16 21:12:52 +00:00
|
|
|
|
|
|
|
#include "include/org_rocksdb_CassandraValueMergeOperator.h"
|
|
|
|
#include "rocksdb/db.h"
|
2018-04-13 00:55:14 +00:00
|
|
|
#include "rocksdb/memtablerep.h"
|
|
|
|
#include "rocksdb/merge_operator.h"
|
2017-06-16 21:12:52 +00:00
|
|
|
#include "rocksdb/options.h"
|
2018-04-13 00:55:14 +00:00
|
|
|
#include "rocksdb/slice_transform.h"
|
2017-06-16 21:12:52 +00:00
|
|
|
#include "rocksdb/statistics.h"
|
|
|
|
#include "rocksdb/table.h"
|
2022-03-01 17:02:15 +00:00
|
|
|
#include "rocksjni/cplusplus_to_java_convert.h"
|
2018-04-13 00:55:14 +00:00
|
|
|
#include "rocksjni/portal.h"
|
2017-07-21 21:42:32 +00:00
|
|
|
#include "utilities/cassandra/merge_operator.h"
|
2017-06-16 21:12:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CassandraValueMergeOperator
|
|
|
|
* Method: newSharedCassandraValueMergeOperator
|
2017-10-02 23:08:53 +00:00
|
|
|
* Signature: (II)J
|
2017-06-16 21:12:52 +00:00
|
|
|
*/
|
2017-08-31 17:10:47 +00:00
|
|
|
jlong Java_org_rocksdb_CassandraValueMergeOperator_newSharedCassandraValueMergeOperator(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* /*env*/, jclass /*jclazz*/, jint gcGracePeriodInSeconds,
|
2017-10-02 23:08:53 +00:00
|
|
|
jint operands_limit) {
|
2020-02-20 20:07:53 +00:00
|
|
|
auto* op = new std::shared_ptr<ROCKSDB_NAMESPACE::MergeOperator>(
|
|
|
|
new ROCKSDB_NAMESPACE::cassandra::CassandraValueMergeOperator(
|
2017-10-02 23:08:53 +00:00
|
|
|
gcGracePeriodInSeconds, operands_limit));
|
2022-03-01 17:02:15 +00:00
|
|
|
return GET_CPLUSPLUS_POINTER(op);
|
2017-06-16 21:12:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_CassandraValueMergeOperator
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_CassandraValueMergeOperator_disposeInternal(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
2017-08-31 17:10:47 +00:00
|
|
|
auto* op =
|
2020-02-20 20:07:53 +00:00
|
|
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::MergeOperator>*>(
|
|
|
|
jhandle);
|
2017-08-31 17:10:47 +00:00
|
|
|
delete op;
|
2017-06-16 21:12:52 +00:00
|
|
|
}
|