feat(discovery): implement P3 S-DISCOVERY-01..04 Discovery catalog and optional DiscoveryRpc adapter
This commit is contained in:
1 parent
0cf187d664
commit
ec8c0bd40a
12 files changed
+2686
No files matched your search
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidDiscoveryOnlyConsumer LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_package(Void REQUIRED CONFIG COMPONENTS Discovery)
|
||||
|
||||
add_executable(discovery_only main.cpp)
|
||||
target_link_libraries(discovery_only PRIVATE Void::Discovery)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME discovery_only COMMAND discovery_only)
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <Void/Discovery/Catalog.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Discovery::Catalog catalog{};
|
||||
Void::Discovery::EndpointRecord rec{};
|
||||
rec.service = "svc";
|
||||
rec.instance = "i-1";
|
||||
rec.endpoint.scheme = "http";
|
||||
rec.endpoint.host = "127.0.0.1";
|
||||
rec.endpoint.port = 8080;
|
||||
|
||||
auto rev = catalog.replace_static({rec});
|
||||
if (!rev.has_value() || *rev != 1U) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
auto snap = catalog.resolve("svc");
|
||||
if (!snap.has_value() || snap->records.size() != 1U) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in new issue
Block a user