]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | // Copyright (c) 2017-present, Facebook, Inc. All rights reserved. |
2 | // This source code is licensed under both the GPLv2 (found in the | |
3 | // COPYING file in the root directory) and Apache 2.0 License | |
4 | // (found in the LICENSE.Apache file in the root directory). | |
5 | ||
6 | #include <jni.h> | |
7 | #include <stdio.h> | |
8 | #include <stdlib.h> | |
1e59de90 | 9 | |
11fdf7f2 TL |
10 | #include <memory> |
11 | #include <string> | |
12 | ||
13 | #include "include/org_rocksdb_CassandraValueMergeOperator.h" | |
14 | #include "rocksdb/db.h" | |
15 | #include "rocksdb/memtablerep.h" | |
16 | #include "rocksdb/merge_operator.h" | |
17 | #include "rocksdb/options.h" | |
18 | #include "rocksdb/slice_transform.h" | |
19 | #include "rocksdb/statistics.h" | |
20 | #include "rocksdb/table.h" | |
1e59de90 | 21 | #include "rocksjni/cplusplus_to_java_convert.h" |
11fdf7f2 TL |
22 | #include "rocksjni/portal.h" |
23 | #include "utilities/cassandra/merge_operator.h" | |
24 | ||
25 | /* | |
26 | * Class: org_rocksdb_CassandraValueMergeOperator | |
27 | * Method: newSharedCassandraValueMergeOperator | |
28 | * Signature: (II)J | |
29 | */ | |
30 | jlong Java_org_rocksdb_CassandraValueMergeOperator_newSharedCassandraValueMergeOperator( | |
31 | JNIEnv* /*env*/, jclass /*jclazz*/, jint gcGracePeriodInSeconds, | |
32 | jint operands_limit) { | |
f67539c2 TL |
33 | auto* op = new std::shared_ptr<ROCKSDB_NAMESPACE::MergeOperator>( |
34 | new ROCKSDB_NAMESPACE::cassandra::CassandraValueMergeOperator( | |
11fdf7f2 | 35 | gcGracePeriodInSeconds, operands_limit)); |
1e59de90 | 36 | return GET_CPLUSPLUS_POINTER(op); |
11fdf7f2 TL |
37 | } |
38 | ||
39 | /* | |
40 | * Class: org_rocksdb_CassandraValueMergeOperator | |
41 | * Method: disposeInternal | |
42 | * Signature: (J)V | |
43 | */ | |
44 | void Java_org_rocksdb_CassandraValueMergeOperator_disposeInternal( | |
45 | JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) { | |
46 | auto* op = | |
f67539c2 TL |
47 | reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::MergeOperator>*>( |
48 | jhandle); | |
11fdf7f2 TL |
49 | delete op; |
50 | } |