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
20 changes: 20 additions & 0 deletions docs/concepts/server-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,23 @@ Discovery is a separate integration decision. The framework does not require eve
## Limits to verify in a deployment

Endpoint connectivity alone does not verify authentication, message delivery after reconnect, state transfer, split-brain behavior or storage consistency. The 100,000–200,000 concurrent-user target is a multi-process deployment goal, not a measured single-process limit. [Benchmarks and acceptance](../performance/benchmark.md) distinguish local correctness/performance tools from cross-host capacity and endurance tests.

## Verify server construction

The built-in server plugins use typed module factories and explicit dynamic-library entry points. Construction keeps the existing plugin version, configuration access, interface RTTI names, installation order and disabled frame updates. Network callbacks, lifecycle methods, protocols and resources retain their existing behavior.

With the [application build dependencies](../networking.md) installed, run:

```sh
cmake -S . -B out/server-construction -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
'-DVCPKG_MANIFEST_FEATURES=application;boost;etcd-client' \
-DCMAKE_BUILD_TYPE=Debug -DASIO_STANDALONE=OFF \
-DARK_BUILD_APPLICATIONS=ON -DARK_BUILD_PROTO=ON \
-DARK_BUILD_CORE_TESTS=ON -DARK_BUILD_EXAMPLES=OFF
cmake --build out/server-construction --target check-server-plugins --parallel 2
```

`check-server-plugins` exercises the real factory and assembly of each of the seven enabled server libraries, checks the retained source include paths, verifies disabled update admission, and loads each actual shared library to inspect both exported entry symbols. Each role runs a minimal core-only export host before its separate real-factory host. This process separation prevents the host and shared library from registering the same statically linked AFProto descriptors twice. A counted substitute through the real Login assembly checks destruction of rejected candidates, preservation of the original registration and a successful retry. `check-core` includes these focused checks in application builds. A separate shared-library fixture runs the real Login entry and exit through the manager loader with a controlled module. The seven business libraries receive export inspection and direct construction checks, without business lifecycle calls. These checks do not start network services or establish deployment readiness.

`node --test tests/ci/server-construction.test.mjs` checks configure-only compatibility forwarding and construction policy without compiling native code. Simulate has source-policy coverage only; its unsupported PhysX 3/MessagePack integration is outside these native targets.
20 changes: 20 additions & 0 deletions docs/concepts/server-architecture_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,23 @@ Bus 插件表示进程地址与路由目标。[Bus 参考](../reference/bus_CN.m
## 部署时需要验证的边界

端点可连通,不等于已经验证鉴权、重连后的消息交付、状态转移、网络分区行为或存储一致性。10 万至 20 万同时在线是多进程部署目标,不是实测的单进程上限。[基准测试与验收](../performance/benchmark_CN.md)区分本机正确性与性能工具,以及跨主机容量和耐久测试。

## 验证服务端创建方式

内置服务端插件使用类型化模块工厂与显式动态库入口。改造保留插件版本、配置访问、接口 RTTI 注册名、安装顺序与关闭帧更新的行为;网络回调、生命周期方法、协议与资源行为保持不变。

安装[应用构建依赖](../networking_CN.md)后运行:

```sh
cmake -S . -B out/server-construction -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
'-DVCPKG_MANIFEST_FEATURES=application;boost;etcd-client' \
-DCMAKE_BUILD_TYPE=Debug -DASIO_STANDALONE=OFF \
-DARK_BUILD_APPLICATIONS=ON -DARK_BUILD_PROTO=ON \
-DARK_BUILD_CORE_TESTS=ON -DARK_BUILD_EXAMPLES=OFF
cmake --build out/server-construction --target check-server-plugins --parallel 2
```

`check-server-plugins` 对七个启用的服务动态库分别检查真实工厂与装配、原有源码包含路径和关闭更新的注册方式,并加载实际动态库检查两个导出入口符号。每个角色先在仅链接核心的最小进程中检查导出,再在独立进程中检查真实工厂,避免宿主与动态库在同一进程内重复注册静态链接的 AFProto 描述符。真实 Login 装配另以计数替身检查被拒绝候选对象的析构、原有注册的保留以及重试成功。应用构建中的 `check-core` 包含这些定向检查。另一个动态库夹具通过管理器加载器运行真实 Login 入口与退出函数,并使用受控模块。七个业务动态库只检查导出与直接创建,不调用业务生命周期。这些检查不启动网络服务,也不代表部署就绪。

`node --test tests/ci/server-construction.test.mjs` 在不编译原生代码的情况下检查兼容转发映射与创建约束。Simulate 只参与源码策略检查,其未受支持的 PhysX 3/MessagePack 集成不在这些原生目标中。
5 changes: 3 additions & 2 deletions docs/guides/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ The bundled examples use capability names. Configure with applications and examp
| `examples/mysql_sample` / `mysql_sample` | `mysql_sample_plugin` | Native MySQL coroutine example; disabled in the application example list, assembly checked by database tests with SSL enabled |
| `examples/redis_sample` / `redis_sample` | `redis_sample_plugin` | Native Redis coroutine example; disabled in the application example list, assembly checked by database tests |
| `examples/physics_scene` / `physics_scene` | `physics_scene_plugin` | Disabled; requires unsupported legacy PhysX 3. The checked-in sources and manifest do not establish a runnable integration |
| `examples/http_server` / `http_server` | `http_server_plugin` | Disabled; retained HTTP server example, without runtime acceptance |
| `examples/http_server` / `http_server` | `http_server_plugin` | Disabled as an application example; [typed construction and controlled DSO regression](../reference/http.md#legacy-http-example-construction) |
| `examples/http_client` / `http_client_sample` | `http_client_sample_plugin` | Disabled as an application example; future/callback POST and etcd lease demonstration with fixed external endpoints |

hpp/cpp files remain adjacent in each directory. Start with the [timers quick start](../get-started/quick-start.md). The generic launcher helpers select `conf/<name>.app.toml`, so use the capability name for both the process and application manifest. Kernel examples still require their business metadata.

Expand All @@ -26,7 +27,7 @@ hpp/cpp files remain adjacent in each directory. Start with the [timers quick st

Rebuild modules and their consumers together: the C++ module/plugin type names and RTTI registration keys change. Replace old library stems such as `sample1_plugin` with `timers_plugin`, including platform extensions and Debug `_d`. Replace staged `conf/sample1.app.toml` with `conf/timers.app.toml` and update `--name`, `--app_conf`, launcher arguments and deployment ConfigMaps consistently for every row. The old targets, library aliases and configuration filenames are not emitted. An existing runtime directory is not migrated automatically; stage a fresh matching executable, plugin set and configuration before switching it over.

The byte-preserved historical documentation archive retains original names and commands. It is not the current naming guide. This page records names and supported status, not new runtime or performance acceptance.
The byte-preserved historical documentation archive retains original names and commands. It is not the current naming guide. This page records names and supported status; the HTTP example fixture uses public service doubles and does not establish external-service or performance acceptance.

## Run entity operations

Expand Down
5 changes: 3 additions & 2 deletions docs/guides/examples_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
| `examples/mysql_sample`/`mysql_sample` | `mysql_sample_plugin` | 原生 MySQL 协程示例;应用示例列表中仍关闭,开启 SSL 的数据库测试检查其装配 |
| `examples/redis_sample`/`redis_sample` | `redis_sample_plugin` | 原生 Redis 协程示例;应用示例列表中仍关闭,数据库测试检查其装配 |
| `examples/physics_scene`/`physics_scene` | `physics_scene_plugin` | 关闭,依赖不支持的旧 PhysX 3;保留源码与清单不代表集成可运行 |
| `examples/http_server`/`http_server` | `http_server_plugin` | 关闭,保留 HTTP 服务示例,尚无运行验收 |
| `examples/http_server`/`http_server` | `http_server_plugin` | 默认应用示例中关闭;支持[类型化创建与受控动态库回归](../reference/http_CN.md#旧-http-示例的类型化创建) |
| `examples/http_client`/`http_client_sample` | `http_client_sample_plugin` | 默认应用示例中关闭;使用固定外部端点演示 future/回调 POST 与 etcd 租约 |

每个目录中的 hpp/cpp 继续并排存放。可从 [timers 快速开始](../get-started/quick-start_CN.md)入手。
通用启动脚本选择 `conf/<name>.app.toml`,因此进程名称和应用清单都应使用能力名称。Kernel 示例仍需要业务元数据。
Expand All @@ -30,7 +31,7 @@
将已部署的 `conf/sample1.app.toml` 换为 `conf/timers.app.toml`,并按上表逐项同步 `--name`、`--app_conf`、启动脚本参数和部署 ConfigMap。
不再生成旧 target、旧库别名或旧配置文件名。已有运行目录不会自动迁移;切换前应重新准备同次构建的可执行文件、插件集与配置。

按字节保存的历史文档归档仍保留原始名称和命令,不作为当前命名指南。本页说明名称和支持边界,不代表新增运行或性能验收。
按字节保存的历史文档归档仍保留原始名称和命令,不作为当前命名指南。本页说明名称与支持边界;HTTP 示例测试使用公开服务替身,不代表外部服务或性能验收。

## 运行实体操作示例

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| `ARK_BUILD_TESTS` | `ON` | Build legacy test programs |
| `ARK_BUILD_CORE_TESTS` | Value of `ARK_BUILD_TESTS` | Build C++20 core and optional Protobuf regressions |
| `ARK_BUILD_EXAMPLES` | `ON` | Build enabled examples |
| `ARK_BUILD_HTTP_EXAMPLE_TESTS` | `ON` for core tests with Boost and HTTP/Net/Etcd Client API targets, otherwise `OFF` | Compile and run actual HTTP example DSOs with isolated service doubles; explicit `OFF` is respected |
| `ARK_BUILD_PLUGIN_MYSQL` | `OFF` | Build the native MySQL coroutine plugin; requires `ARKNET_ENABLE_SSL=ON` |
| `ARK_BUILD_PLUGIN_REDIS` | `OFF` | Build the native Redis coroutine plugin; enable SSL for TLS pools |
| `ARK_BUILD_DATABASE_TESTS` | `OFF` | Build native database and public plugin regressions; requires an explicit `ARKNET_SOURCE_DIR` |
Expand All @@ -24,7 +25,7 @@ When upgrading arknet, use a new build directory or explicitly change the cached

Official plugin options use `ARK_BUILD_PLUGIN_<NAME>`. The default runtime selection is `kernel`, `net`, `bus`, `utility` and `etcd_client`; enable the optional MySQL/Redis targets to build native coroutine plugins. Protocol and plugin-load tests do not replace real-server deployment acceptance. See [project layout](directory-structure.md), [protocol generation](protobuf.md) and [network builds](../networking.md).

With `ARK_BUILD_EXAMPLES` enabled, the [coroutine task example](../guides/tasks.md) also builds with applications disabled. Existing plugin examples still require application builds.
With `ARK_BUILD_EXAMPLES` enabled, the [coroutine task example](../guides/tasks.md) also builds with applications disabled. Enabled application plugin examples still require application builds. HTTP example construction tests can run separately with core tests; see [HTTP examples](http.md#legacy-http-example-construction).

See [MySQL](mysql.md) and [Redis](redis.md) for plugin configuration and coroutine APIs.

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/build-options_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| `ARK_BUILD_TESTS` | `ON` | 构建原有测试程序 |
| `ARK_BUILD_CORE_TESTS` | 与 `ARK_BUILD_TESTS` 一致 | 构建 C++20 核心与可选的 Protobuf 回归测试 |
| `ARK_BUILD_EXAMPLES` | `ON` | 构建选中的示例 |
| `ARK_BUILD_HTTP_EXAMPLE_TESTS` | 核心测试使用 Boost 且具备 HTTP/Net/Etcd Client API target 时为 `ON`,否则为 `OFF` | 通过独立服务替身编译并运行真实 HTTP 示例动态库;保留显式 `OFF` |
| `ARK_BUILD_PLUGIN_MYSQL` | `OFF` | 构建原生 MySQL 协程插件,要求 `ARKNET_ENABLE_SSL=ON` |
| `ARK_BUILD_PLUGIN_REDIS` | `OFF` | 构建原生 Redis 协程插件,TLS 连接池需要开启 SSL |
| `ARK_BUILD_DATABASE_TESTS` | `OFF` | 构建原生数据库及公开插件回归,要求显式设置 `ARKNET_SOURCE_DIR` |
Expand All @@ -24,7 +25,7 @@

官方插件选项采用 `ARK_BUILD_PLUGIN_<NAME>`。默认运行时插件为 `kernel`、`net`、`bus`、`utility` 和 `etcd_client`;启用 MySQL 或 Redis 构建选项可使用原生协程插件;本机协议测试与插件加载检查不能替代真实数据库部署验收。参见[项目结构](directory-structure_CN.md)、[协议生成](protobuf_CN.md)与[网络构建](../networking_CN.md)。

开启 `ARK_BUILD_EXAMPLES` 时,[协程任务示例](../guides/tasks_CN.md)可以在关闭应用的情况下独立构建;其余现有插件示例仍要求开启应用构建。
开启 `ARK_BUILD_EXAMPLES` 时,[协程任务示例](../guides/tasks_CN.md)可以在关闭应用的情况下独立构建;默认启用的应用插件示例仍要求开启应用构建。HTTP 示例创建测试可以随核心测试单独运行,详见 [HTTP 示例](http_CN.md#旧-http-示例的类型化创建)。

数据库插件的配置与接口见 [MySQL](mysql_CN.md) 和 [Redis](redis_CN.md)。

Expand Down
9 changes: 9 additions & 0 deletions docs/reference/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ cmake --build etcd-client-headers --target check-etcd-client-headers --parallel

Header mapping does not establish Consul, Kafka or OSS SDK runtime compatibility. Physic and `physics_scene` still require the unsupported legacy PhysX 3 integration and retain their explicit configuration failure; no passing PhysX build is claimed.


## Built-in server source layout

The eight server source families co-locate their interface, implementation and plugin hpp/cpp files in `src/server/<role>/`. Each implementation derives from `module_base<interface_type>`; private factories supply interface-owned `std::unique_ptr` values to `plugin_base`. The nine existing modules retain interface RTTI registration names and disabled frame updates. Each library defines its `DllEntryPlugin` and `DllExitPlugin` functions explicitly.

Server source includes such as `login/interface/login_net_module.hpp` and `login/include/login_plugin.hpp` remain available through build-tree forwarding headers under `src/server/compat-include/`. Internal source uses adjacent headers. The forwarding inventory preserves all 28 previous headers, including implementation and plugin declarations, without adding the private factory headers to that inventory. This compatibility mapping is separate from public `<ark/...>` mappings and is not a new installed server API. Rebuild C++ consumers after changing the concrete inheritance chain.

With `ARK_BUILD_APPLICATIONS=ON`, CMake builds seven server libraries: Game, Login, Proxy, World, Master, Dir and Router. The Simulate sources use the same construction pattern, but their target remains disabled and its explicit unsupported PhysX 3/MessagePack configuration failure is retained. Source colocation does not validate that integration. See [server architecture](../concepts/server-architecture.md#verify-server-construction) for the focused construction checks and their limits.

## Installed layout

[Installation](../get-started/installation.md#install-and-consume-the-cmake-package) preserves logical `<ark/...>` headers under `<prefix>/include/ark/`. CMake package files use the GNUInstallDirs library directory under `cmake/ark/`; selected launcher and runtime plugins install under `bin/`. Configuration samples and licensing are under `share/ark/`. Consumers use `find_package(ark CONFIG REQUIRED)` and `ark::core` / `ark::<plugin>` targets; source consumers use `add_subdirectory` with the same target names. Neither requires a generated mapping path. Source/build directories are absent from installed exports; arknet and other dependencies remain external. `tests/install/` contains independent installed consumers and the disposable-producer relocation test.
9 changes: 9 additions & 0 deletions docs/reference/directory-structure_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,12 @@ cmake --build etcd-client-headers --target check-etcd-client-headers --parallel
## 安装目录

[安装](../get-started/installation_CN.md#安装并消费-cmake-包)后,逻辑 `<ark/...>` 头位于 `<prefix>/include/ark/`。CMake 包文件位于 GNUInstallDirs 库目录下的 `cmake/ark/`,选定启动程序与运行时插件位于 `bin/`,配置样例与许可证位于 `share/ark/`。安装消费者使用 `find_package(ark CONFIG REQUIRED)` 和 `ark::core`/`ark::<plugin>`;源码消费者使用 `add_subdirectory` 和相同 target,无需指定生成映射路径。安装导出不包含源码或构建目录;arknet 等依赖仍由外部提供。`tests/install/` 保存独立安装消费者与删除临时生产者后的迁移检查。


## 内置服务端源码布局

八组服务端源码将接口、实现与插件的 hpp/cpp 共置于 `src/server/<role>/`。实现类继承 `module_base<interface_type>`,私有工厂向 `plugin_base` 提供由接口类型持有的 `std::unique_ptr`。原有九个模块保留接口 RTTI 注册名,均不启用帧更新。每个动态库显式定义 `DllEntryPlugin` 与 `DllExitPlugin`。

`login/interface/login_net_module.hpp`、`login/include/login_plugin.hpp` 等源码包含路径通过构建树中的 `src/server/compat-include/` 转发头保留,内部源码使用相邻头文件。转发清单保留原有全部 28 个头文件,包括实现与插件声明,但不包含新增的私有工厂头。该兼容映射独立于公开 `<ark/...>` 映射,不新增可安装的服务端 API。具体类的继承链变化后,C++ 消费方需要重新编译。

设置 `ARK_BUILD_APPLICATIONS=ON` 后,CMake 编译 Game、Login、Proxy、World、Master、Dir、Router 七个服务动态库。Simulate 源码采用相同创建方式,但仍不参与默认构建,并保留未受支持的 PhysX 3/MessagePack 集成配置失败。源码共置不代表该集成已经通过验证。定向创建检查及其边界见[服务器架构](../concepts/server-architecture_CN.md#验证服务端创建方式)。
Loading
Loading