]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/rocksjni/merge_operator.cc
1 // Copyright (c) 2014, Vlad Balan (vlad.gm@gmail.com). 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).
6 // This file implements the "bridge" between Java and C++
7 // for rocksdb::MergeOperator.
15 #include "include/org_rocksdb_StringAppendOperator.h"
16 #include "include/org_rocksdb_UInt64AddOperator.h"
17 #include "rocksdb/db.h"
18 #include "rocksdb/memtablerep.h"
19 #include "rocksdb/merge_operator.h"
20 #include "rocksdb/options.h"
21 #include "rocksdb/slice_transform.h"
22 #include "rocksdb/statistics.h"
23 #include "rocksdb/table.h"
24 #include "rocksjni/portal.h"
25 #include "utilities/merge_operators.h"
28 * Class: org_rocksdb_StringAppendOperator
29 * Method: newSharedStringAppendOperator
32 jlong
Java_org_rocksdb_StringAppendOperator_newSharedStringAppendOperator(
33 JNIEnv
* /*env*/, jclass
/*jclazz*/, jchar jdelim
) {
34 auto* sptr_string_append_op
= new std::shared_ptr
<rocksdb::MergeOperator
>(
35 rocksdb::MergeOperators::CreateStringAppendOperator((char)jdelim
));
36 return reinterpret_cast<jlong
>(sptr_string_append_op
);
40 * Class: org_rocksdb_StringAppendOperator
41 * Method: disposeInternal
44 void Java_org_rocksdb_StringAppendOperator_disposeInternal(JNIEnv
* /*env*/,
47 auto* sptr_string_append_op
=
48 reinterpret_cast<std::shared_ptr
<rocksdb::MergeOperator
>*>(jhandle
);
49 delete sptr_string_append_op
; // delete std::shared_ptr
53 * Class: org_rocksdb_UInt64AddOperator
54 * Method: newSharedUInt64AddOperator
57 jlong
Java_org_rocksdb_UInt64AddOperator_newSharedUInt64AddOperator(
58 JNIEnv
* /*env*/, jclass
/*jclazz*/) {
59 auto* sptr_uint64_add_op
= new std::shared_ptr
<rocksdb::MergeOperator
>(
60 rocksdb::MergeOperators::CreateUInt64AddOperator());
61 return reinterpret_cast<jlong
>(sptr_uint64_add_op
);
65 * Class: org_rocksdb_UInt64AddOperator
66 * Method: disposeInternal
69 void Java_org_rocksdb_UInt64AddOperator_disposeInternal(JNIEnv
* /*env*/,
72 auto* sptr_uint64_add_op
=
73 reinterpret_cast<std::shared_ptr
<rocksdb::MergeOperator
>*>(jhandle
);
74 delete sptr_uint64_add_op
; // delete std::shared_ptr