Clean Tests
This commit is contained in:
94
README.md
94
README.md
@ -1,2 +1,94 @@
|
||||
# IACore
|
||||
# IACore (Independent Architecture Core)
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
IACore is a high-performance, battery-included C++20 foundation library designed to eliminate "dependency hell." It bundles essential systems—IPC, Logging, Networking, Compression, and Async Scheduling—into a single, coherent API.
|
||||
|
||||
Originally developed as the internal core for IASoft (PVT) LTD., it is now open-source to provide a standardized bedrock for C++ applications.
|
||||
|
||||
## ✨ Features
|
||||
|
||||
* **🚀 High-Performance IPC:** Shared-Memory Ring Buffers with wait-free SPSC synchronization.
|
||||
* **🌐 Networking:** Integrated HTTP/HTTPS client (wrapper around `cpp-httplib` with automatic Zlib/Gzip/Brotli handling).
|
||||
* **🧵 Async Scheduler:** A job system with high/normal priority queues and work stealing.
|
||||
* **💾 File I/O:** Memory-mapped file operations and optimized binary stream readers/writers.
|
||||
* **📦 Compression:** Unified API for Zlib, Gzip, and Zstd.
|
||||
* **📜 Logging:** Thread-safe, colored console and disk logging.
|
||||
* **⚡ Modern C++:** Heavily uses C++20 concepts, `std::span`, and `tl::expected` for error handling.
|
||||
|
||||
## 🛠️ Integration
|
||||
|
||||
IACore is built with CMake. You can include it in your project via `FetchContent` or by adding it as a subdirectory.
|
||||
|
||||
### CMake Example
|
||||
```cmake
|
||||
add_subdirectory(IACore)
|
||||
|
||||
add_executable(MyApp Main.cpp)
|
||||
target_link_libraries(MyApp PRIVATE IACore)
|
||||
```
|
||||
|
||||
## 📦 Dependencies
|
||||
IACore manages its own dependencies via CMake's FetchContent. You do not need to install these manually:
|
||||
|
||||
* nlohmann_json & glaze (JSON Parsing)
|
||||
* cpp-httplib (Networking)
|
||||
* zlib-ng & zstd (Compression)
|
||||
* tl-expected (Error Handling)
|
||||
|
||||
## 💡 Usage Examples
|
||||
### 1. IPC (Manager & Node)
|
||||
IACore provides a manager/node architecture using shared memory.
|
||||
|
||||
Manager:
|
||||
|
||||
```C++
|
||||
#include <IACore/IPC.hpp>
|
||||
|
||||
// Spawns a child process and connects via Shared Memory
|
||||
auto nodeID = manager.SpawnNode("MyChildNodeExe");
|
||||
manager.WaitTillNodeIsOnline(*nodeID);
|
||||
|
||||
// Send data with zero-copy overhead
|
||||
String msg = "Hello Node";
|
||||
manager.SendPacket(*nodeID, 100, {(PCUINT8)msg.data(), msg.size()});
|
||||
```
|
||||
|
||||
### 2. Async Jobs
|
||||
```C++
|
||||
|
||||
#include <IACore/AsyncOps.hpp>
|
||||
|
||||
// Initialize worker threads (hardware_concurrency - 2)
|
||||
IACore::AsyncOps::InitializeScheduler();
|
||||
|
||||
// Schedule a task
|
||||
IACore::AsyncOps::Schedule *mySchedule = new IACore::AsyncOps::Schedule();
|
||||
|
||||
IACore::AsyncOps::ScheduleTask([](auto workerID) {
|
||||
printf("Running on worker %d\n", workerID);
|
||||
}, 0, mySchedule);
|
||||
|
||||
// Wait for completion
|
||||
IACore::AsyncOps::WaitForScheduleCompletion(mySchedule);
|
||||
```
|
||||
|
||||
### 3. HTTP Request
|
||||
```C++
|
||||
#include <IACore/HttpClient.hpp>
|
||||
|
||||
IACore::HttpClient client("[https://api.example.com](https://api.example.com)");
|
||||
auto res = client.JsonGet<MyResponseStruct>("/data", {});
|
||||
|
||||
if (res) {
|
||||
std::cout << "Data: " << res->value << "\n";
|
||||
} else {
|
||||
std::cerr << "Error: " << res.error() << "\n";
|
||||
}
|
||||
```
|
||||
|
||||
## ⚖️ License
|
||||
|
||||
This project is licensed under the GNU General Public License v3 (GPLv3).
|
||||
Reference in New Issue
Block a user