2014-04-21 22:40:46 +00:00
|
|
|
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
|
|
|
|
// This source code is licensed under the BSD-style license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
//
|
|
|
|
// This file implements the "bridge" between Java and C++ for MemTables.
|
|
|
|
|
2014-09-17 19:30:06 +00:00
|
|
|
#include "rocksjni/portal.h"
|
2014-04-21 22:40:46 +00:00
|
|
|
#include "include/org_rocksdb_HashSkipListMemTableConfig.h"
|
|
|
|
#include "include/org_rocksdb_HashLinkedListMemTableConfig.h"
|
|
|
|
#include "include/org_rocksdb_VectorMemTableConfig.h"
|
|
|
|
#include "include/org_rocksdb_SkipListMemTableConfig.h"
|
|
|
|
#include "rocksdb/memtablerep.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_HashSkipListMemTableConfig
|
|
|
|
* Method: newMemTableFactoryHandle
|
|
|
|
* Signature: (JII)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_HashSkipListMemTableConfig_newMemTableFactoryHandle(
|
|
|
|
JNIEnv* env, jobject jobj, jlong jbucket_count,
|
|
|
|
jint jheight, jint jbranching_factor) {
|
|
|
|
return reinterpret_cast<jlong>(rocksdb::NewHashSkipListRepFactory(
|
2014-09-17 19:30:06 +00:00
|
|
|
rocksdb::jlong_to_size_t(jbucket_count),
|
2014-04-21 22:40:46 +00:00
|
|
|
static_cast<int32_t>(jheight),
|
|
|
|
static_cast<int32_t>(jbranching_factor)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_HashLinkedListMemTableConfig
|
|
|
|
* Method: newMemTableFactoryHandle
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_HashLinkedListMemTableConfig_newMemTableFactoryHandle(
|
|
|
|
JNIEnv* env, jobject jobj, jlong jbucket_count) {
|
|
|
|
return reinterpret_cast<jlong>(rocksdb::NewHashLinkListRepFactory(
|
2014-09-17 19:30:06 +00:00
|
|
|
rocksdb::jlong_to_size_t(jbucket_count)));
|
2014-04-21 22:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_VectorMemTableConfig
|
|
|
|
* Method: newMemTableFactoryHandle
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_VectorMemTableConfig_newMemTableFactoryHandle(
|
|
|
|
JNIEnv* env, jobject jobj, jlong jreserved_size) {
|
|
|
|
return reinterpret_cast<jlong>(new rocksdb::VectorRepFactory(
|
2014-09-17 19:30:06 +00:00
|
|
|
rocksdb::jlong_to_size_t(jreserved_size)));
|
2014-04-21 22:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_SkipListMemTableConfig
|
|
|
|
* Method: newMemTableFactoryHandle0
|
|
|
|
* Signature: ()J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_SkipListMemTableConfig_newMemTableFactoryHandle0(
|
|
|
|
JNIEnv* env, jobject jobj) {
|
|
|
|
return reinterpret_cast<jlong>(new rocksdb::SkipListFactory());
|
|
|
|
}
|