Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci-cd-multi-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
generator: "Unix Makefiles",
cc: "gcc",
cxx: "g++",
jobs_count: 4,
initial_cache: ".github/workflows/linux_initial_cache.txt",
}
- {
Expand Down Expand Up @@ -113,17 +114,18 @@ jobs:
-DCMAKE_C_COMPILER=${{ matrix.config.cc }}
-DCMAKE_BUILD_TYPE=Release
-DUSER_CONFIG="${{ matrix.platforms.user_config }}"
-DAE_BUILD_TESTS=On
-C "${{ matrix.config.initial_cache }}"
-S projects/cmake

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build build --config Release --parallel
run: cmake --build build --config Release --parallel ${{ matrix.config.jobs_count }}

- name: Test
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --test-dir build --build-config Release --output-on-failure
run: ctest --test-dir build --build-config Release --output-on-failure --parallel

- name: Upload
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

filter=-readability/todo # this requered author to all todo
filter=-readability/multiline_string # this prevents from using multiline strings
filter=-readability/braces # this prevents using concepts
filter=-runtime/references # this forbids from using references as return value
filter=-runtime/int # some libraries requires use long long int instead of sized int64_t
filter=-build/c++17 # this prevents to use <filesystem>
Expand Down
14 changes: 12 additions & 2 deletions aether/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@

cmake_minimum_required(VERSION 3.16.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(AE_PROJECT_VERSION "0.1.0")

option(AE_NO_STRIP_ALL "Do not apply --strip_all, useful for bloaty and similar tools " Off)
option(AE_DISTILLATION "Build aether in distillation mode" On)
option(AE_FILTRATION "Build aether in filtration mode" Off)
option(AE_BUILD_TESTS "Build tests" Off)

set(UTM_ID "0" CACHE STRING "User Tracking Measurement ID, must be a uint32 value")
set(USER_CONFIG "" CACHE PATH "Path to user provided configuration header file")
Expand Down Expand Up @@ -546,8 +547,17 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${TARGET_NAME} PUBLIC /Zc:preprocessor)
endif()

if(REGULAR_CMAKE_PROJECT)
if(AE_BUILD_TESTS)
message(STATUS "Aether builds tests!")
# enable doubles in unity tests
add_compile_definitions("UNITY_INCLUDE_DOUBLE")

target_link_libraries(${TARGET_NAME} PRIVATE inline_tests)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../tests ${CMAKE_BINARY_DIR}/tests)
endif()


if(REGULAR_CMAKE_PROJECT AND NOT AE_BUILD_TESTS)
## Target installation
install(TARGETS ${TARGET_NAME}
EXPORT ${TARGET_NAME}Targets
Expand Down
1 change: 1 addition & 0 deletions aether/access_points/wifi_access_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# include <utility>

# include "aether/aether.h"
# include "aether/server.h"
# include "aether/poller/poller.h"
# include "aether/dns/dns_resolve.h"
# include "aether/adapters/wifi_adapter.h"
Expand Down
2 changes: 1 addition & 1 deletion aether/actions/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class StageRunner<TFunc> {

public:
using type =
typename ActionType<typename FunctionSignature<TFunc>::Ret>::type;
typename ActionType<typename FunctionSignature<TFunc>::ret>::type;

explicit StageRunner(TFunc&& factory) : factory_(std::move(factory)) {}

Expand Down
2 changes: 2 additions & 0 deletions aether/adapters/wifi_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# include "aether/dns/dns_resolve.h"
# include "aether/wifi/wifi_driver_factory.h"

# include "aether/tele/tele.h"

namespace ae {
# if defined AE_DISTILLATION
WifiAdapter::WifiAdapter(ObjProp prop, ObjPtr<Aether> aether,
Expand Down
1 change: 1 addition & 0 deletions aether/ae_actions/select_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <cassert>

#include "aether/aether.h"
#include "aether/client.h"
#include "aether/registration/registration.h"

#include "aether/ae_actions/ae_actions_tele.h"
Expand Down
11 changes: 6 additions & 5 deletions aether/ae_actions/select_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
#include <cstdint>

#include "aether/config.h"
#include "aether/client.h"
#include "aether/ptr/ptr_view.h"
#include "aether/obj/obj_ptr.h"
#include "aether/actions/action.h"
#include "aether/actions/action_ptr.h"
#include "aether/types/state_machine.h"
#include "aether/events/event_subscription.h"

namespace ae {
class Aether;
class Client;
class Registration;

class SelectClientAction final : public Action<SelectClientAction> {
Expand All @@ -43,7 +44,7 @@ class SelectClientAction final : public Action<SelectClientAction> {
/**
* \brief Create with client already ready.
*/
SelectClientAction(ActionContext action_context, Client::ptr client);
SelectClientAction(ActionContext action_context, ObjPtr<Client> client);

#if AE_SUPPORT_REGISTRATION
/**
Expand All @@ -61,11 +62,11 @@ class SelectClientAction final : public Action<SelectClientAction> {

UpdateStatus Update();

Client::ptr const& client() const;
ObjPtr<Client> const& client() const;
State state() const;

private:
Client::ptr client_;
ObjPtr<Client> client_;
StateMachine<State> state_;

#if AE_SUPPORT_REGISTRATION
Expand Down
5 changes: 4 additions & 1 deletion aether/ae_actions/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# include "aether/aether.h"
# include "aether/format/format.h"
# include "aether/tele/traps/statistics_trap.h"
# include "aether/tele/traps/tele_statistics.h"

# include "aether/mstream.h"
# include "aether/mstream_buffers.h"
Expand Down Expand Up @@ -111,7 +112,9 @@ std::optional<Telemetric> Telemetry::CollectTelemetry(
return std::nullopt;
}
auto& statistics_storage =
aether_ptr->tele_statistics->trap()->statistics_store;
tele::TeleStatistics::ptr{aether_ptr->tele_statistics}
->trap()
->statistics_store;
auto& env_storage = statistics_storage.env_store();
Telemetric res{};
res.cpp.utm_id = env_storage.utm_id;
Expand Down
19 changes: 17 additions & 2 deletions aether/aether.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,38 @@

#include <utility>

#include "aether/global_ids.h"
#include "aether/obj/obj_ptr.h"
#include "aether/ae_actions/time_sync.h"
#include "aether/actions/action_processor.h"

#include "aether/client.h"
#include "aether/server.h"
#include "aether/registration_cloud.h"

#include "aether/work_cloud.h"
#include "aether/registration/registration.h"

#include "aether/aether_tele.h"

namespace ae {

Aether::Aether(ObjProp prop) : Obj{prop} { AE_TELE_DEBUG(AetherCreated); }
Aether::Aether() : action_processor{make_unique<ActionProcessor>()} {}

Aether::Aether(ObjProp prop)
: Obj{prop}, action_processor{make_unique<ActionProcessor>()} {
AE_TELE_DEBUG(AetherCreated);
}

Aether::~Aether() { AE_TELE_DEBUG(AetherDestroyed); }

void Aether::Update(TimePoint current_time) {
update_time = action_processor->Update(current_time);
}

Aether::operator ActionContext() const {
return ActionContext{*action_processor};
}

Client::ptr Aether::CreateClient(ClientConfig const& config,
std::string const& client_id) {
auto client = FindClient(client_id);
Expand Down
69 changes: 37 additions & 32 deletions aether/aether.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,33 @@
#include "aether/obj/obj.h"
#include "aether/actions/action_ptr.h"
#include "aether/types/client_config.h"
#include "aether/ae_actions/time_sync.h"

#include "aether/actions/action_context.h"
#include "aether/actions/action_processor.h"
#include "aether/ae_actions/select_client.h"
#include "aether/tele/traps/tele_statistics.h"
#include "aether/registration/registration.h" // IWYU pragma: keep

#include "aether/client.h"
#include "aether/crypto.h"
#include "aether/server.h"
#include "aether/uap/uap.h"
#include "aether/poller/poller.h"
#include "aether/dns/dns_resolve.h"
#include "aether/adapter_registry.h"
#include "aether/registration_cloud.h"

namespace ae {
class Server;
class Client;
class Crypto;
class IPoller;
class DnsResolver;
class Registration;
class TimeSyncAction;
class AdapterRegistry;
class ActionProcessor;
class RegistrationCloud;
class RegistrationCloud;

namespace tele {
class TeleStatistics;
}

class Aether : public Obj {
AE_OBJECT(Aether, Obj, 0)

Aether() = default;
Aether();

public:
// Internal.
Expand Down Expand Up @@ -75,40 +81,39 @@ class Aether : public Obj {
void Update(TimePoint current_time) override;

// User-facing API.
operator ActionContext() const { return ActionContext{*action_processor}; }
operator ActionContext() const;

Client::ptr CreateClient(ClientConfig const& config,
std::string const& client_id);
ObjPtr<Client> CreateClient(ClientConfig const& config,
std::string const& client_id);
ActionPtr<SelectClientAction> SelectClient(Uid parent_uid,
std::string const& client_id);

void StoreServer(Server::ptr s);
Server::ptr GetServer(ServerId server_id);
void StoreServer(ObjPtr<Server> s);
ObjPtr<Server> GetServer(ServerId server_id);

Client::ptr client_prefab;
RegistrationCloud::ptr registration_cloud;
Obj::ptr client_prefab;
Obj::ptr registration_cloud;

Crypto::ptr crypto;
IPoller::ptr poller;
DnsResolver::ptr dns_resolver;
Obj::ptr crypto;
Obj::ptr poller;
Obj::ptr dns_resolver;

AdapterRegistry::ptr adapter_registry;
Obj::ptr adapter_registry;
Uap::ptr uap;

tele::TeleStatistics::ptr tele_statistics;
Obj::ptr tele_statistics;

std::unique_ptr<ActionProcessor> action_processor =
make_unique<ActionProcessor>();
std::unique_ptr<ActionProcessor> action_processor;

private:
Client::ptr FindClient(std::string const& client_id);
void StoreClient(Client::ptr client);
ObjPtr<Client> FindClient(std::string const& client_id);
void StoreClient(ObjPtr<Client> client);

ActionPtr<SelectClientAction> FindSelectClientAction(
std::string const& client_id);
ActionPtr<SelectClientAction> MakeSelectClient() const;
ActionPtr<SelectClientAction> MakeSelectClient(
Client::ptr const& client) const;
ObjPtr<Client> const& client) const;
#if AE_SUPPORT_REGISTRATION
ActionPtr<SelectClientAction> MakeSelectClient(
ActionPtr<Registration> registration, std::string const& client_id);
Expand All @@ -119,10 +124,10 @@ class Aether : public Obj {
private:
#endif

void MakeTimeSyncAction(Client::ptr const& client);
void MakeTimeSyncAction(ObjPtr<Client> const& client);

std::map<std::string, Client::ptr> clients_;
std::map<ServerId, Server::ptr> servers_;
std::map<std::string, Obj::ptr> clients_;
std::map<ServerId, Obj::ptr> servers_;

std::map<std::string, ActionPtr<SelectClientAction>> select_client_actions_;
#if AE_TIME_SYNC_ENABLED
Expand Down
Loading