feat(rpc): implement P2 S-RPC-01..03 Wire v1 binary codec and unary HTTP/1.1 RPC subsystem

This commit is contained in:
faumaray committed 2026-11-27 01:27:32 +03:00
1 parent 691808eab6
commit 5184d1cf8c
11 files changed
+1778 -1

No files matched your search

+13
View File
@@ -305,6 +305,19 @@ if(_has_testing_mock)
run_consumer(TestingMockOnly "${install_prefix}" "TestingMockOnly" ${_no_external_deps})
endif()
has_modules(_has_short_url ShortUrl Service Time Functional)
if(_has_short_url)
run_consumer(ShortUrlOnly "${install_prefix}" "ShortUrlOnly" ${_no_external_deps})
endif()
has_modules(_has_rpc RPC Net Binary Data Time Async Functional Core)
if(_has_rpc)
run_consumer(RpcOnly "${install_prefix}" "RpcOnly"
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_SQLite3=TRUE)
endif()
# Foundation consumer with Core-formatting bridge and zero external packages.
has_modules(_has_foundation Math Text Time Functional Binary FunctionalCoreFormatting Memory Core)
if(_has_foundation)
+14
View File
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 4.0)
project(VoidRpcOnlyConsumer LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Void CONFIG REQUIRED COMPONENTS RPC)
add_executable(rpc_only_consumer main.cpp)
target_link_libraries(rpc_only_consumer PRIVATE Void::RPC)
enable_testing()
add_test(NAME rpc_only_consumer COMMAND rpc_only_consumer)
+26
View File
@@ -0,0 +1,26 @@
#include <Void/RPC/Codec.hpp>
#include <Void/RPC/Rpc.hpp>
#include <cstddef>
#include <cstring>
int main()
{
using namespace Void::RPC;
Server server;
constexpr MethodId kPing{1, 1};
auto reg = server.bind(
MethodDescriptor{kPing, "sys", "ping", 1, true},
[](const CallContext&, OwnedBytes body) { return Void::Result::ok(body); });
if (!reg.has_value() || !server.start().has_value()) {
return 1;
}
Client client{ClientOptions{.endpoint_base_url = server.base_url()}};
OwnedBytes payload{std::byte{'o'}, std::byte{'k'}};
auto resp = client.call(kPing, payload);
server.shutdown();
if (!resp.has_value() || resp->size() != 2 || (*resp)[0] != std::byte{'o'}) {
return 2;
}
return 0;
}