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