Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Licensed under the Apache License, Version 2.0.
Copyright (C) 2014 Stephen Macke ([email protected])
* DirectIoLib in pixels-common is partially derived from Jaydio.

7. RocksDB-Cloud
Licensed under the Apache License, Version 2.0.
* RocksetJni in pixels-index-rockset is partially modified from RocksDB-Cloud Jni.


According to the requirement of Apache License Version 2.0 (Apache 2.0), we include a copy of Apache 2.0 here:

Expand Down
23 changes: 16 additions & 7 deletions cpp/pixels-index/pixels-index-rockset/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,25 @@ add_dependencies(RocksDB::rocksdb rocksdb_cloud)
include_directories(
${JNI_INCLUDE_DIRS} # JNI headers (jni.h, jni_md.h)
${ROCKSDB_CLOUD_INCLUDE_DIR} # RocksDB-Cloud headers
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/jni
)

# 8. Build pixels-index-rockset shared library
set(SOURCES
lib/RocksetJni.cpp
# 8. Collect all JNI cpp files
file(GLOB ROCKSET_JNI_SOURCES
${CMAKE_SOURCE_DIR}/lib/jni/*.cpp
)
add_library(pixels-index-rockset SHARED ${SOURCES})

# 9. Link RocksDB and its dependencies
message(STATUS "Rockset JNI sources: ${ROCKSET_JNI_SOURCES}")


# 9. Build pixels-index-rockset shared library
add_library(pixels-index-rockset SHARED
${ROCKSET_JNI_SOURCES}
)

add_dependencies(pixels-index-rockset rocksdb_cloud)

# 10. ink RocksDB and its dependencies
target_link_libraries(pixels-index-rockset
RocksDB::rocksdb
z
Expand All @@ -97,6 +106,6 @@ target_link_libraries(pixels-index-rockset
dl
)

# 10. install pixels-index-rockset to ${PIXELS_HOME}/lib
# 11. Install pixels-index-rockset to ${PIXELS_HOME}/lib
install(TARGETS pixels-index-rockset
LIBRARY DESTINATION ${PIXELS_HOME}/lib)
165 changes: 0 additions & 165 deletions cpp/pixels-index/pixels-index-rockset/include/RocksetJni.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

/*
* This macro is used for 32 bit OS. In 32 bit OS, the result number is a
negative number if we use reinterpret_cast<jlong>(pointer).
* For example, jlong ptr = reinterpret_cast<jlong>(pointer), ptr is a negative
number in 32 bit OS.
* If we check ptr using ptr > 0, it fails. For example, the following code is
not correct.
* if (jblock_cache_handle > 0) {
std::shared_ptr<ROCKSDB_NAMESPACE::Cache> *pCache =
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::Cache> *>(
jblock_cache_handle);
options.block_cache = *pCache;
}
* But the result number is positive number if we do
reinterpret_cast<size_t>(pointer) first and then cast it to jlong. size_t is 4
bytes long in 32 bit OS and 8 bytes long in 64 bit OS.
static_cast<jlong>(reinterpret_cast<size_t>(_pointer)) is also working in 64
bit OS.
*
* We don't need an opposite cast because it works from jlong to c++ pointer in
both 32 bit and 64 bit OS.
* For example, the following code is working in both 32 bit and 64 bit OS.
jblock_cache_handle is jlong.
* std::shared_ptr<ROCKSDB_NAMESPACE::Cache> *pCache =
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::Cache> *>(
jblock_cache_handle);
*/

#define GET_CPLUSPLUS_POINTER(_pointer) \
static_cast<jlong>(reinterpret_cast<size_t>(_pointer))

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading