-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Merge branch import_braft (#300)
* feat:import braft (#130) * feat: Implementing Redis-Raft commands to build a cluster. (#136) Co-authored-by: panlei-coder <[email protected]> Co-authored-by: century <[email protected]> Co-authored-by: panlei-coder <[email protected]> Co-authored-by: alexstocks <[email protected]> Co-authored-by: dingxiaoshuai123 <[email protected]> Co-authored-by: longfar <[email protected]>
- Loading branch information
1 parent
184f54b
commit e9e535b
Showing
77 changed files
with
4,626 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Import BRaft Actions (Temporary) | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ "import-braft" ] | ||
|
||
jobs: | ||
check_format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
run: bash ci/build.sh | ||
|
||
- name: Check Format | ||
working-directory: ${{ github.workspace }}/build | ||
run: make check-format | ||
|
||
build_on_macos: | ||
runs-on: macos-latest | ||
needs: check_format | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
env: | ||
CPLUS_INCLUDE_PATH: /opt/homebrew/include | ||
run: | | ||
brew install autoconf | ||
brew install go | ||
sh build.sh | ||
- name: Run Go E2E Tests | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cd ../tests | ||
go mod tidy | ||
go test ./pikiwidb_suite_test.go ./consistency_test.go -v | ||
build_on_ubuntu: | ||
runs-on: ubuntu-latest | ||
needs: check_format | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
run: | | ||
bash build.sh | ||
- name: Run Go E2E Tests | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cd ../tests | ||
go mod tidy | ||
go test ./pikiwidb_suite_test.go ./consistency_test.go -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 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(ExternalProject) | ||
|
||
SET(BRAFT_SOURCES_DIR ${THIRD_PARTY_PATH}/braft) | ||
SET(BRAFT_INSTALL_DIR ${THIRD_PARTY_PATH}/install/braft) | ||
SET(BRAFT_INCLUDE_DIR "${BRAFT_INSTALL_DIR}/include" CACHE PATH "braft include directory." FORCE) | ||
SET(BRAFT_LIBRARIES "${BRAFT_INSTALL_DIR}/lib/libbraft.a" CACHE FILEPATH "braft library." FORCE) | ||
|
||
SET(prefix_path "${THIRD_PARTY_PATH}/install/brpc|${CMAKE_CURRENT_BINARY_DIR}/_deps/gflags-build|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${CMAKE_CURRENT_BINARY_DIR}/_deps/leveldb-build|${CMAKE_CURRENT_BINARY_DIR}/_deps/leveldb-src") | ||
|
||
ExternalProject_Add( | ||
extern_braft | ||
${EXTERNAL_PROJECT_LOG_ARGS} | ||
DEPENDS brpc | ||
GIT_REPOSITORY "https://github.com/pikiwidb/braft.git" | ||
GIT_TAG master | ||
PREFIX ${BRAFT_SOURCES_DIR} | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||
-DCMAKE_INSTALL_PREFIX=${BRAFT_INSTALL_DIR} | ||
-DCMAKE_INSTALL_LIBDIR=${BRAFT_INSTALL_DIR}/lib | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON | ||
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE} | ||
-DCMAKE_PREFIX_PATH=${prefix_path} | ||
-DBRPC_WITH_GLOG=OFF | ||
${EXTERNAL_OPTIONAL_ARGS} | ||
LIST_SEPARATOR | | ||
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${BRAFT_INSTALL_DIR} | ||
-DCMAKE_INSTALL_LIBDIR:PATH=${BRAFT_INSTALL_DIR}/lib | ||
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON | ||
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE} | ||
BUILD_IN_SOURCE 1 | ||
BUILD_COMMAND $(MAKE) -j ${CPU_CORE} braft-static | ||
INSTALL_COMMAND mkdir -p ${BRAFT_INSTALL_DIR}/lib/ COMMAND cp ${BRAFT_SOURCES_DIR}/src/extern_braft/output/lib/libbraft.a ${BRAFT_LIBRARIES} COMMAND cp -r ${BRAFT_SOURCES_DIR}/src/extern_braft/output/include ${BRAFT_INCLUDE_DIR}/ | ||
) | ||
ADD_DEPENDENCIES(extern_braft brpc) | ||
ADD_LIBRARY(braft STATIC IMPORTED GLOBAL) | ||
SET_PROPERTY(TARGET braft PROPERTY IMPORTED_LOCATION ${BRAFT_LIBRARIES}) | ||
ADD_DEPENDENCIES(braft extern_braft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 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(ExternalProject) | ||
|
||
SET(BRPC_SOURCES_DIR ${THIRD_PARTY_PATH}/brpc) | ||
SET(BRPC_INSTALL_DIR ${THIRD_PARTY_PATH}/install/brpc) | ||
SET(BRPC_INCLUDE_DIR "${BRPC_INSTALL_DIR}/include" CACHE PATH "brpc include directory." FORCE) | ||
SET(BRPC_LIBRARIES "${BRPC_INSTALL_DIR}/lib/libbrpc.a" CACHE FILEPATH "brpc library." FORCE) | ||
|
||
# Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args | ||
SET(prefix_path "${CMAKE_CURRENT_BINARY_DIR}/_deps/gflags-build|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${CMAKE_CURRENT_BINARY_DIR}/_deps/leveldb-build|${CMAKE_CURRENT_BINARY_DIR}/_deps/leveldb-src") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") | ||
# If minimal .a is need, you can set WITH_DEBUG_SYMBOLS=OFF | ||
EXTERNALPROJECT_ADD( | ||
extern_brpc | ||
${EXTERNAL_PROJECT_LOG_ARGS} | ||
DEPENDS ssl crypto zlib protobuf leveldb gflags | ||
URL https://github.com/apache/brpc/archive/refs/tags/1.8.0.tar.gz | ||
URL_HASH SHA256=13ffb2f1f57c679379a20367c744b3e597614a793ec036cd7580aae90798019d | ||
PREFIX ${BRPC_SOURCES_DIR} | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||
-DCMAKE_INSTALL_PREFIX=${BRPC_INSTALL_DIR} | ||
-DCMAKE_INSTALL_LIBDIR=${BRPC_INSTALL_DIR}/lib | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON | ||
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE} | ||
-DCMAKE_PREFIX_PATH=${prefix_path} | ||
-DWITH_GLOG=OFF | ||
-DDOWNLOAD_GTEST=OFF | ||
${EXTERNAL_OPTIONAL_ARGS} | ||
LIST_SEPARATOR | | ||
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${BRPC_INSTALL_DIR} | ||
-DCMAKE_INSTALL_LIBDIR:PATH=${BRPC_INSTALL_DIR}/lib | ||
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON | ||
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE} | ||
BUILD_IN_SOURCE 1 | ||
BUILD_COMMAND $(MAKE) -j ${CPU_CORE} brpc-static | ||
INSTALL_COMMAND mkdir -p ${BRPC_INSTALL_DIR}/lib/ COMMAND cp ${BRPC_SOURCES_DIR}/src/extern_brpc/output/lib/libbrpc.a ${BRPC_LIBRARIES} COMMAND cp -r ${BRPC_SOURCES_DIR}/src/extern_brpc/output/include ${BRPC_INCLUDE_DIR}/ | ||
) | ||
ADD_DEPENDENCIES(extern_brpc ssl crypto zlib protobuf leveldb gflags) | ||
ADD_LIBRARY(brpc STATIC IMPORTED GLOBAL) | ||
SET_PROPERTY(TARGET brpc PROPERTY IMPORTED_LOCATION ${BRPC_LIBRARIES}) | ||
ADD_DEPENDENCIES(brpc extern_brpc) |
Oops, something went wrong.