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
|
|
|
|
|
|
|
#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 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(
|
2017-10-02 23:08:53 +00:00
|
|
|
JNIEnv* env, jclass jclazz, jint gcGracePeriodInSeconds,
|
|
|
|
jint operands_limit) {
|
2017-08-31 17:10:47 +00:00
|
|
|
auto* op = new std::shared_ptr<rocksdb::MergeOperator>(
|
|
|
|
new rocksdb::cassandra::CassandraValueMergeOperator(
|
2017-10-02 23:08:53 +00:00
|
|
|
gcGracePeriodInSeconds, operands_limit));
|
2017-08-31 17:10:47 +00:00
|
|
|
return reinterpret_cast<jlong>(op);
|
2017-06-16 21:12:52 +00: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 17:10:47 +00:00
|
|
|
auto* op =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::MergeOperator>*>(jhandle);
|
|
|
|
delete op;
|
2017-06-16 21:12:52 +00:00
|
|
|
}
|