Skip to content

Commit

Permalink
Remove CLI code; further refactoring of commands and models (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xg0nz0 committed Feb 25, 2024
1 parent ddceec5 commit 97fdbbe
Show file tree
Hide file tree
Showing 17 changed files with 917 additions and 249 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/install-vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ install_debian_packages() {
pkg-config
bash-completion
ninja-build
git)
git
libtool)

if ! dpkg -s "${package_list[@]}" >/dev/null 2>&1; then
apt_get_update_if_needed
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ on:
- "**.h"
- "**/CMakeLists.txt"
- "**.cmake"
- "**.json"
- ".github/workflows/ci.yml"

jobs:
core:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand Down
58 changes: 40 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,49 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
endif()

# set up library dependencies
find_package(argh CONFIG REQUIRED)
find_package(benchmark CONFIG REQUIRED)
find_package(cpptoml CONFIG REQUIRED)
find_package(libuv CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(unofficial-sodium CONFIG REQUIRED)

# these do not correctly support CMake
find_path(SODIUM_INCLUDE_DIR sodium.h REQUIRED)

# customize the builds of key networking components; WolfSSL is not
# well supported in vcpkg and we want to have more control here
include(ExternalProject)
execute_process(COMMAND nproc OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NPROC)
ExternalProject_Add(wolfssl
GIT_REPOSITORY https://github.com/wolfSSL/wolfssl
GIT_TAG v5.6.6-stable
PREFIX ${CMAKE_BINARY_DIR}/wolfssl
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND autoreconf -i COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --enable-all --enable-harden --enable-keylog-export --disable-ech
BUILD_COMMAND make -j ${NPROC}
INSTALL_COMMAND make install
UPDATE_COMMAND ""
)
ExternalProject_Add(nghttp3
GIT_REPOSITORY https://github.com/ngtcp2/nghttp3.git
GIT_TAG v1.2.0
PREFIX ${CMAKE_BINARY_DIR}/nghttp3
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND git submodule update --init COMMAND autoreconf -i COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --enable-lib-only
BUILD_COMMAND make -j ${NPROC}
INSTALL_COMMAND make install
UPDATE_COMMAND ""
)
ExternalProject_Add(ngtcp2
GIT_REPOSITORY https://github.com/ngtcp2/ngtcp2.git
GIT_TAG v1.3.0
PREFIX ${CMAKE_BINARY_DIR}/ngtcp2
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND autoreconf -i COMMAND <SOURCE_DIR>/configure PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/wolfssl/lib/pkgconfig:${CMAKE_BINARY_DIR}/nghttp3/lib/pkgconfig --prefix=<INSTALL_DIR> --with-wolfssl --enable-asan --enable-lib-only
BUILD_COMMAND make -j ${NPROC}
INSTALL_COMMAND make install
UPDATE_COMMAND ""
DEPENDS nghttp3 wolfssl
)

add_library(
iggy

Expand All @@ -25,21 +61,7 @@ add_library(
sdk/serialization.cc
)
target_compile_features(iggy PRIVATE cxx_std_17)
target_include_directories(iggy PRIVATE ${unofficial-sodium_DIR}/../../include)

add_executable(
iggy_cmd

examples/cli/cli.cc
examples/cli/iggy_cmd.cc
)
target_include_directories(iggy_cmd PRIVATE ${argh_INCLUDE_DIR})
target_link_libraries(
iggy_cmd

iggy
unofficial-sodium::sodium
)
target_include_directories(iggy PRIVATE ${SODIUM_INCLUDE_DIR} ${USOCKETS_INCLUDE_DIR})

if (BUILD_TESTS)
add_subdirectory(tests)
Expand Down
6 changes: 0 additions & 6 deletions examples/cli/cli.cc

This file was deleted.

38 changes: 0 additions & 38 deletions examples/cli/cli.h

This file was deleted.

24 changes: 0 additions & 24 deletions examples/cli/iggy_cmd.cc

This file was deleted.

17 changes: 0 additions & 17 deletions fuzz/CMakeLists.txt

This file was deleted.

6 changes: 0 additions & 6 deletions fuzz/pub_client.cc

This file was deleted.

4 changes: 2 additions & 2 deletions sdk/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void iggy::client::Client::ping() {
ping_process.wait(reproc::milliseconds(5000));
}

iggy::model::Stats iggy::client::Client::getStats() {
iggy::model::system::Stats iggy::client::Client::getStats() {
// temporary! need to send GetStats command to server then use WireFormat to read the response
return iggy::model::Stats();
return iggy::model::system::Stats();
}
2 changes: 1 addition & 1 deletion sdk/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Client {
/**
* @brief Get the Iggy server's performance statistics.
*/
iggy::model::Stats getStats();
iggy::model::system::Stats getStats();
};
}; // namespace client
}; // namespace iggy
Loading

0 comments on commit 97fdbbe

Please sign in to comment.