Skip to content

Commit

Permalink
basic commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lihuiba committed Oct 14, 2024
1 parent 3e5b1d3 commit 9bf5316
Show file tree
Hide file tree
Showing 7 changed files with 623 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.linux.arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ jobs:
- name: Test
run: |
cd build
nohup redis-server
ctest -E test-lockfree --timeout 3600 -V
pkill redis-server
gcc921-build-debug:
runs-on: [self-hosted, Linux, ARM64]
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ci.linux.x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ jobs:
cmake --build build -j $(nproc) -- VERBOSE=1
- name: Test epoll
run: |
nohup redis-server
cd build && ctest -E test-lockfree --timeout 3600 -V
pkill redis-server
- name: Test io_uring
run: |
export PHOTON_CI_EV_ENGINE=io_uring
Expand Down Expand Up @@ -66,7 +68,9 @@ jobs:
cmake --build build -j $(nproc) -- VERBOSE=1
- name: Test epoll
run: |
nohup redis-server
cd build && ctest -E test-lockfree --timeout 3600 -V
pkill redis-server
- name: Test io_uring
run: |
export PHOTON_CI_EV_ENGINE=io_uring
Expand Down Expand Up @@ -101,7 +105,9 @@ jobs:
cmake --build build -j $(nproc) -- VERBOSE=1
- name: Test epoll
run: |
nohup redis-server
cd build && ctest -E test-lockfree --timeout 3600 -V
pkill redis-server
- name: Test io_uring
run: |
export PHOTON_CI_EV_ENGINE=io_uring
Expand Down Expand Up @@ -136,7 +142,9 @@ jobs:
cmake --build build -j $(nproc) -- VERBOSE=1
- name: Test epoll
run: |
nohup redis-server
cd build && ctest -E test-lockfree --timeout 3600 -V
pkill redis-server
- name: Test io_uring
run: |
export PHOTON_CI_EV_ENGINE=io_uring
Expand Down Expand Up @@ -171,7 +179,9 @@ jobs:
cmake --build build -j $(nproc) -- VERBOSE=1
- name: Test epoll
run: |
nohup redis-server
cd build && ctest -E test-lockfree --timeout 3600 -V
pkill redis-server
- name: Test io_uring
run: |
export PHOTON_CI_EV_ENGINE=io_uring
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ set(PHOTON_GOOGLETEST_SOURCE "https://github.com/google/googletest/archive/refs/
set(PHOTON_RAPIDJSON_GIT "https://github.com/Tencent/rapidjson.git" CACHE STRING "")
set(PHOTON_RAPIDXML_SOURCE "https://sourceforge.net/projects/rapidxml/files/rapidxml/rapidxml%201.13/rapidxml-1.13.zip/download" CACHE STRING "")
set(PHOTON_RAPIDYAML_SOURCE "https://github.com/biojppm/rapidyaml/releases/download/v0.5.0/rapidyaml-0.5.0.hpp" CACHE STRING "")
set(PHOTON_CPP_REDIS_SOURCE "https://github.com/cpp-redis/cpp_redis/archive/refs/tags/4.3.1.tar.gz" CACHE STRING "")

# Get CPU arch
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down
19 changes: 2 additions & 17 deletions ecosystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

include(FetchContent)

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
# set DOWNLOAD_EXTRACT_TIMESTAMP ON cmake 3.24 or above
cmake_policy(SET CMP0135 NEW)
endif()
Expand Down Expand Up @@ -50,26 +50,11 @@ if (CMAKE_VERSION VERSION_LESS "3.18.0")
endif()
message(STATUS "Rapidyaml source dir: ${rapidyaml_SOURCE_DIR}")

# cpp-redis
FetchContent_Declare(
cpp-redis
URL ${PHOTON_CPP_REDIS_SOURCE}
URL_HASH
SHA256=3859289d8254685fc775bda73de03dad27df923423b8ceb375b02d036c03b02f
UPDATE_DISCONNECTED 1)
# uses only a simple header, so do not add sub directory to avoid unnecessary build
# do not use FetchContent_MakeAvailable, just populate it.
FetchContent_GetProperties(cpp-redis)
if(NOT cpp-redis_POPULATED)
FetchContent_Populate(cpp-redis)
endif()
message(STATUS "cpp-redis source dir: ${cpp-redis_SOURCE_DIR}")

add_library(ecosystem_deps INTERFACE)
target_include_directories(
ecosystem_deps
INTERFACE ${rapidjson_SOURCE_DIR}/include ${rapidxml_SOURCE_DIR} ${rapidyaml_SOURCE_DIR}
${cpp-redis_SOURCE_DIR}/includes)
)
get_property(
incs
TARGET ecosystem_deps
Expand Down
8 changes: 5 additions & 3 deletions ecosystem/redis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace photon {
using namespace net;
namespace redis {

any BufferedStream::parse_item() {
any BufferedStream::parse_response_item() {
switch (auto mark = this->get_char()) {
case simple_string::mark():
return get_simple_string();
Expand All @@ -35,9 +35,11 @@ any BufferedStream::parse_item() {
return get_integer();
case bulk_string::mark():
return get_bulk_string();
case array<>::mark():
return {array<>(), get_integer()};
case array_header::mark(): {
auto x = get_integer();
return array_header{x};}
default:
LOG_ERROR("uncognized mark: ", mark);
return {};
}
}
Expand Down
Loading

0 comments on commit 9bf5316

Please sign in to comment.