Update to use Auxid
Some checks failed
CI / build-linux-and-wasm (x64-linux) (push) Has been cancelled
Some checks failed
CI / build-linux-and-wasm (x64-linux) (push) Has been cancelled
This commit is contained in:
@ -15,8 +15,8 @@ set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
|
|||||||
set(WITH_GZFILEOP ON CACHE BOOL "" FORCE)
|
set(WITH_GZFILEOP ON CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
Oxide
|
Auxid
|
||||||
GIT_REPOSITORY https://github.com/I-A-S/Oxide
|
GIT_REPOSITORY https://github.com/I-A-S/Auxid
|
||||||
GIT_TAG main
|
GIT_TAG main
|
||||||
OVERRIDE_FIND_PACKAGE
|
OVERRIDE_FIND_PACKAGE
|
||||||
)
|
)
|
||||||
@ -133,7 +133,7 @@ if(NOT TARGET zstd::libzstd)
|
|||||||
add_library(zstd::libzstd ALIAS libzstd_static)
|
add_library(zstd::libzstd ALIAS libzstd_static)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_MakeAvailable(Oxide httplib pugixml nlohmann_json glaze simdjson unordered_dense mimalloc highway)
|
FetchContent_MakeAvailable(Auxid httplib pugixml nlohmann_json glaze simdjson unordered_dense mimalloc highway)
|
||||||
|
|
||||||
if(NOT TARGET simdjson::simdjson)
|
if(NOT TARGET simdjson::simdjson)
|
||||||
add_library(simdjson::simdjson ALIAS simdjson)
|
add_library(simdjson::simdjson ALIAS simdjson)
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
IACore is a high-performance C++20 foundation library bundling essential systems (IPC, Logging, Networking, Compression, and Async Scheduling) into a single, coherent API.
|
IACore is a high-performance C++20 foundation library bundling essential systems (IPC, Logging, Networking, Compression, and Async Scheduling) into a single, coherent API.
|
||||||
|
|
||||||
IACore strictly follows the coding style and philosophy of [Oxide](https://github.com/I-A-S/Oxide).
|
IACore strictly follows the coding style and philosophy of [Auxid](https://github.com/I-A-S/Auxid).
|
||||||
|
|
||||||
Originally developed as the internal core for IASoft (PVT) LTD., it is now open-source to provide a standardized bedrock for C++ applications where performance matters.
|
Originally developed as the internal core for IASoft (PVT) LTD., it is now open-source to provide a standardized bedrock for C++ applications where performance matters.
|
||||||
|
|
||||||
@ -43,12 +43,12 @@ IACore provides a manager/node architecture using shared memory.
|
|||||||
#include <IACore/IPC.hpp>
|
#include <IACore/IPC.hpp>
|
||||||
|
|
||||||
// Spawns a child process and connects via Shared Memory
|
// Spawns a child process and connects via Shared Memory
|
||||||
auto nodeID = manager.spawn_node("MyChildNodeExe");
|
auto node_id = manager.spawn_node("MyChildNodeExe");
|
||||||
manager.wait_till_node_is_online(*nodeID);
|
manager.wait_till_node_is_online(*node_id);
|
||||||
|
|
||||||
// Send data with zero-copy overhead
|
// Send data with zero-copy overhead
|
||||||
String msg = "Hello Node";
|
String msg = "Hello Node";
|
||||||
manager.send_packet(*nodeID, 100, {(PCUINT8)msg.data(), msg.size()});
|
manager.send_packet(*node_id, 100, {(PCUINT8)msg.data(), msg.size()});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Node:
|
#### Node:
|
||||||
|
|||||||
@ -30,7 +30,7 @@ target_include_directories(IACore PRIVATE imp/hpp/)
|
|||||||
target_link_libraries(IACore PUBLIC
|
target_link_libraries(IACore PUBLIC
|
||||||
hwy
|
hwy
|
||||||
zlib
|
zlib
|
||||||
Oxide
|
Auxid
|
||||||
zstd::libzstd
|
zstd::libzstd
|
||||||
glaze::glaze
|
glaze::glaze
|
||||||
httplib::httplib
|
httplib::httplib
|
||||||
|
|||||||
@ -86,11 +86,11 @@ auto IpcNode::connect(Const<const char *> connection_string) -> Result<void> {
|
|||||||
Ref<IpcConnectionDescriptor> desc = *desc_opt;
|
Ref<IpcConnectionDescriptor> desc = *desc_opt;
|
||||||
m_shm_name = desc.shared_mem_path;
|
m_shm_name = desc.shared_mem_path;
|
||||||
|
|
||||||
m_socket = OX_TRY(SocketOps::create_unix_socket());
|
m_socket = AU_TRY(SocketOps::create_unix_socket());
|
||||||
OX_TRY_PURE(
|
AU_TRY_PURE(
|
||||||
SocketOps::connect_unix_socket(m_socket, desc.socket_path.c_str()));
|
SocketOps::connect_unix_socket(m_socket, desc.socket_path.c_str()));
|
||||||
|
|
||||||
Mut<u8 *> mapped_ptr = OX_TRY(FileOps::map_shared_memory(
|
Mut<u8 *> mapped_ptr = AU_TRY(FileOps::map_shared_memory(
|
||||||
desc.shared_mem_path, desc.shared_mem_size, false));
|
desc.shared_mem_path, desc.shared_mem_size, false));
|
||||||
m_shared_memory = mapped_ptr;
|
m_shared_memory = mapped_ptr;
|
||||||
|
|
||||||
@ -108,11 +108,11 @@ auto IpcNode::connect(Const<const char *> connection_string) -> Result<void> {
|
|||||||
Mut<u8 *> moni_ptr = m_shared_memory + layout->moni_data_offset;
|
Mut<u8 *> moni_ptr = m_shared_memory + layout->moni_data_offset;
|
||||||
Mut<u8 *> mino_ptr = m_shared_memory + layout->mino_data_offset;
|
Mut<u8 *> mino_ptr = m_shared_memory + layout->mino_data_offset;
|
||||||
|
|
||||||
m_moni = OX_TRY(RingBufferView::create(
|
m_moni = AU_TRY(RingBufferView::create(
|
||||||
&layout->moni_control,
|
&layout->moni_control,
|
||||||
Span<u8>(moni_ptr, static_cast<usize>(layout->moni_data_size)), false));
|
Span<u8>(moni_ptr, static_cast<usize>(layout->moni_data_size)), false));
|
||||||
|
|
||||||
m_mino = OX_TRY(RingBufferView::create(
|
m_mino = AU_TRY(RingBufferView::create(
|
||||||
&layout->mino_control,
|
&layout->mino_control,
|
||||||
Span<u8>(mino_ptr, static_cast<usize>(layout->mino_data_size)), false));
|
Span<u8>(mino_ptr, static_cast<usize>(layout->mino_data_size)), false));
|
||||||
|
|
||||||
@ -304,10 +304,10 @@ auto IpcManager::spawn_node(Ref<Path> executable_path,
|
|||||||
sock_path = std::format("/tmp/ia_sess_{}.sock", sid);
|
sock_path = std::format("/tmp/ia_sess_{}.sock", sid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
session->listener_socket = OX_TRY(SocketOps::create_unix_socket());
|
session->listener_socket = AU_TRY(SocketOps::create_unix_socket());
|
||||||
OX_TRY_PURE(
|
AU_TRY_PURE(
|
||||||
SocketOps::bind_unix_socket(session->listener_socket, sock_path.c_str()));
|
SocketOps::bind_unix_socket(session->listener_socket, sock_path.c_str()));
|
||||||
OX_TRY_PURE(SocketOps::listen(session->listener_socket, 1));
|
AU_TRY_PURE(SocketOps::listen(session->listener_socket, 1));
|
||||||
|
|
||||||
#if IA_PLATFORM_WINDOWS
|
#if IA_PLATFORM_WINDOWS
|
||||||
Mut<u_long> mode = 1;
|
Mut<u_long> mode = 1;
|
||||||
@ -318,7 +318,7 @@ auto IpcManager::spawn_node(Ref<Path> executable_path,
|
|||||||
|
|
||||||
Const<String> shm_name = std::format("ia_shm_{}", sid);
|
Const<String> shm_name = std::format("ia_shm_{}", sid);
|
||||||
session->mapped_ptr =
|
session->mapped_ptr =
|
||||||
OX_TRY(FileOps::map_shared_memory(shm_name, shared_memory_size, true));
|
AU_TRY(FileOps::map_shared_memory(shm_name, shared_memory_size, true));
|
||||||
|
|
||||||
Mut<IpcSharedMemoryLayout *> layout =
|
Mut<IpcSharedMemoryLayout *> layout =
|
||||||
reinterpret_cast<IpcSharedMemoryLayout *>(session->mapped_ptr);
|
reinterpret_cast<IpcSharedMemoryLayout *>(session->mapped_ptr);
|
||||||
@ -339,13 +339,13 @@ auto IpcManager::spawn_node(Ref<Path> executable_path,
|
|||||||
layout->mino_data_offset = header_size + half_size;
|
layout->mino_data_offset = header_size + half_size;
|
||||||
layout->mino_data_size = half_size;
|
layout->mino_data_size = half_size;
|
||||||
|
|
||||||
session->moni = OX_TRY(RingBufferView::create(
|
session->moni = AU_TRY(RingBufferView::create(
|
||||||
&layout->moni_control,
|
&layout->moni_control,
|
||||||
Span<u8>(session->mapped_ptr + layout->moni_data_offset,
|
Span<u8>(session->mapped_ptr + layout->moni_data_offset,
|
||||||
static_cast<usize>(layout->moni_data_size)),
|
static_cast<usize>(layout->moni_data_size)),
|
||||||
true));
|
true));
|
||||||
|
|
||||||
session->mino = OX_TRY(RingBufferView::create(
|
session->mino = AU_TRY(RingBufferView::create(
|
||||||
&layout->mino_control,
|
&layout->mino_control,
|
||||||
Span<u8>(session->mapped_ptr + layout->mino_data_offset,
|
Span<u8>(session->mapped_ptr + layout->mino_data_offset,
|
||||||
static_cast<usize>(layout->mino_data_size)),
|
static_cast<usize>(layout->mino_data_size)),
|
||||||
@ -358,7 +358,7 @@ auto IpcManager::spawn_node(Ref<Path> executable_path,
|
|||||||
|
|
||||||
Const<String> args = std::format("\"{}\"", desc.serialize());
|
Const<String> args = std::format("\"{}\"", desc.serialize());
|
||||||
|
|
||||||
session->node_process = OX_TRY(ProcessOps::spawn_process_async(
|
session->node_process = AU_TRY(ProcessOps::spawn_process_async(
|
||||||
FileOps::normalize_executable_path(executable_path).string(), args,
|
FileOps::normalize_executable_path(executable_path).string(), args,
|
||||||
[sid](Const<StringView> line) {
|
[sid](Const<StringView> line) {
|
||||||
if (Env::IS_DEBUG) {
|
if (Env::IS_DEBUG) {
|
||||||
|
|||||||
@ -196,10 +196,10 @@ auto ProcessOps::spawn_process_windows(
|
|||||||
|
|
||||||
return static_cast<i32>(exit_code);
|
return static_cast<i32>(exit_code);
|
||||||
#else
|
#else
|
||||||
OX_UNUSED(command);
|
AU_UNUSED(command);
|
||||||
OX_UNUSED(args);
|
AU_UNUSED(args);
|
||||||
OX_UNUSED(on_output_line_callback);
|
AU_UNUSED(on_output_line_callback);
|
||||||
OX_UNUSED(id);
|
AU_UNUSED(id);
|
||||||
return fail("Windows implementation not available.");
|
return fail("Windows implementation not available.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -298,10 +298,10 @@ auto ProcessOps::spawn_process_posix(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
OX_UNUSED(command);
|
AU_UNUSED(command);
|
||||||
OX_UNUSED(args);
|
AU_UNUSED(args);
|
||||||
OX_UNUSED(on_output_line_callback);
|
AU_UNUSED(on_output_line_callback);
|
||||||
OX_UNUSED(id);
|
AU_UNUSED(id);
|
||||||
return fail("Posix implementation not available.");
|
return fail("Posix implementation not available.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace IACore {
|
|||||||
auto StreamReader::create_from_file(Ref<Path> path) -> Result<StreamReader> {
|
auto StreamReader::create_from_file(Ref<Path> path) -> Result<StreamReader> {
|
||||||
Mut<usize> size = 0;
|
Mut<usize> size = 0;
|
||||||
|
|
||||||
Const<const u8 *> ptr = OX_TRY(FileOps::map_file(path, size));
|
Const<const u8 *> ptr = AU_TRY(FileOps::map_file(path, size));
|
||||||
|
|
||||||
Mut<StreamReader> reader(Span<const u8>(ptr, size));
|
Mut<StreamReader> reader(Span<const u8>(ptr, size));
|
||||||
reader.m_storage_type = StorageType::OwningMmap;
|
reader.m_storage_type = StorageType::OwningMmap;
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public:
|
|||||||
template <typename FuncT>
|
template <typename FuncT>
|
||||||
IA_NODISCARD auto get_function(Ref<String> name) const -> Result<FuncT> {
|
IA_NODISCARD auto get_function(Ref<String> name) const -> Result<FuncT> {
|
||||||
Mut<void *> sym = nullptr;
|
Mut<void *> sym = nullptr;
|
||||||
sym = OX_TRY(get_symbol(name));
|
sym = AU_TRY(get_symbol(name));
|
||||||
return reinterpret_cast<FuncT>(sym);
|
return reinterpret_cast<FuncT>(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
#if IA_PLATFORM_WINDOWS
|
#if IA_PLATFORM_WINDOWS
|
||||||
using NativeFileHandle = HANDLE;
|
using NativeFileHandle = HANDLE;
|
||||||
static constexpr ox::Const<NativeFileHandle> INVALID_FILE_HANDLE =
|
static constexpr au::Const<NativeFileHandle> INVALID_FILE_HANDLE =
|
||||||
INVALID_HANDLE_VALUE;
|
INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
using NativeFileHandle = int;
|
using NativeFileHandle = int;
|
||||||
static constexpr ox::Const<NativeFileHandle> INVALID_FILE_HANDLE = -1;
|
static constexpr au::Const<NativeFileHandle> INVALID_FILE_HANDLE = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace IACore {
|
namespace IACore {
|
||||||
|
|||||||
@ -69,7 +69,7 @@ template <typename ResponseType>
|
|||||||
auto HttpClient::json_get(Ref<String> path, Span<Const<Header>> headers)
|
auto HttpClient::json_get(Ref<String> path, Span<Const<Header>> headers)
|
||||||
-> Result<ResponseType> {
|
-> Result<ResponseType> {
|
||||||
Const<String> raw_response =
|
Const<String> raw_response =
|
||||||
OX_TRY(raw_get(path, headers, "application/json"));
|
AU_TRY(raw_get(path, headers, "application/json"));
|
||||||
|
|
||||||
if (last_response_code() != EResponseCode::OK) {
|
if (last_response_code() != EResponseCode::OK) {
|
||||||
return fail("Server responded with code {}",
|
return fail("Server responded with code {}",
|
||||||
@ -81,10 +81,10 @@ auto HttpClient::json_get(Ref<String> path, Span<Const<Header>> headers)
|
|||||||
template <typename PayloadType, typename ResponseType>
|
template <typename PayloadType, typename ResponseType>
|
||||||
auto HttpClient::json_post(Ref<String> path, Span<Const<Header>> headers,
|
auto HttpClient::json_post(Ref<String> path, Span<Const<Header>> headers,
|
||||||
Ref<PayloadType> body) -> Result<ResponseType> {
|
Ref<PayloadType> body) -> Result<ResponseType> {
|
||||||
Const<String> encoded_body = OX_TRY(Json::encode_struct(body));
|
Const<String> encoded_body = AU_TRY(Json::encode_struct(body));
|
||||||
|
|
||||||
Const<String> raw_response =
|
Const<String> raw_response =
|
||||||
OX_TRY(raw_post(path, headers, encoded_body, "application/json"));
|
AU_TRY(raw_post(path, headers, encoded_body, "application/json"));
|
||||||
|
|
||||||
if (last_response_code() != EResponseCode::OK) {
|
if (last_response_code() != EResponseCode::OK) {
|
||||||
return fail("Server responded with code {}",
|
return fail("Server responded with code {}",
|
||||||
|
|||||||
@ -68,18 +68,18 @@
|
|||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include <ankerl/unordered_dense.h>
|
||||||
|
|
||||||
#include <oxide/oxide.hpp>
|
#include <auxid/auxid.hpp>
|
||||||
|
|
||||||
namespace IACore {
|
namespace IACore {
|
||||||
|
|
||||||
using namespace Oxide;
|
using namespace Auxid;
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Build Environment & Constants
|
// Build Environment & Constants
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
namespace Env {
|
namespace Env {
|
||||||
|
|
||||||
using namespace Oxide::Env;
|
using namespace Auxid::Env;
|
||||||
|
|
||||||
#if IA_PLATFORM_WINDOWS
|
#if IA_PLATFORM_WINDOWS
|
||||||
constexpr Const<bool> IS_WINDOWS = true;
|
constexpr Const<bool> IS_WINDOWS = true;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ using namespace IACore;
|
|||||||
IACORE_MAIN() {
|
IACORE_MAIN() {
|
||||||
(void)args;
|
(void)args;
|
||||||
|
|
||||||
OX_TRY_PURE(SocketOps::initialize());
|
AU_TRY_PURE(SocketOps::initialize());
|
||||||
|
|
||||||
std::cout
|
std::cout
|
||||||
<< console::GREEN
|
<< console::GREEN
|
||||||
|
|||||||
Reference in New Issue
Block a user