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
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <jni.h>
|
|
|
|
#include <string>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "include/org_rocksdb_CassandraValueMergeOperator.h"
|
|
|
|
#include "rocksjni/portal.h"
|
|
|
|
#include "rocksdb/db.h"
|
|
|
|
#include "rocksdb/options.h"
|
|
|
|
#include "rocksdb/statistics.h"
|
|
|
|
#include "rocksdb/memtablerep.h"
|
|
|
|
#include "rocksdb/table.h"
|
|
|
|
#include "rocksdb/slice_transform.h"
|
|
|
|
#include "rocksdb/merge_operator.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(
|
2017-10-03 01:08:53 +02:00
|
|
|
JNIEnv* env, jclass jclazz, jint gcGracePeriodInSeconds,
|
|
|
|
jint operands_limit) {
|
2017-08-31 19:10:47 +02:00
|
|
|
auto* op = new std::shared_ptr<rocksdb::MergeOperator>(
|
|
|
|
new rocksdb::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(
|
|
|
|
JNIEnv* env, jobject jobj, jlong jhandle) {
|
2017-08-31 19:10:47 +02:00
|
|
|
auto* op =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::MergeOperator>*>(jhandle);
|
|
|
|
delete op;
|
2017-06-16 23:12:52 +02:00
|
|
|
}
|