Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rocksdb): add rocksdb instance to compile #46

Merged
merged 1 commit into from
Nov 21, 2023
Merged
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ include(cmake/llhttp.cmake)
include(cmake/fmt.cmake)
include(cmake/spdlog.cmake)
include(cmake/folly.cmake)
include(cmake/rocksdb.cmake)


ADD_SUBDIRECTORY(src/pstd)
Expand Down
14 changes: 14 additions & 0 deletions cmake/rocksdb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2023-present, Qihoo, 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.
include_guard()

FetchContent_Declare(
rocksdb
GIT_REPOSITORY https://github.com/facebook/rocksdb.git
GIT_TAG v8.6.7
)

FetchContent_MakeAvailable(rocksdb)
include_directories(${rocksdb_SOURCE_DIR}/include)
2 changes: 2 additions & 0 deletions src/pikiwidb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <thread>

#include "log.h"
#include "rocksdb/db.h"

#include "client.h"
#include "command.h"
Expand Down Expand Up @@ -292,6 +293,7 @@ static void InitLogs() {
}

int main(int ac, char* av[]) {
[[maybe_unused]] rocksdb::DB* db;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加这么一个没用的变量,是何意啊?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先引入用来测试一下编译有没有问题,后面会把这个去掉

g_pikiwidb = std::make_unique<PikiwiDB>();
pstd::InitRandom();
InitSignal();
Expand Down