Skip to content

Commit f552266

Browse files
Add Lagrange.Core.Internal (#27)
Signed-off-by: Don Yihtseu <[email protected]>
1 parent 98544d1 commit f552266

File tree

7 files changed

+45
-0
lines changed

7 files changed

+45
-0
lines changed

docs/v2/.vitepress/catalogue.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,35 @@ export const coreSidebar = {
55
{
66
text: "Lagrange.Core",
77
link: "/Lagrange.Core/",
8+
},
9+
{
10+
text: "Internal",
11+
items: [
12+
{
13+
text: "Context",
14+
link: "/Lagrange.Core/Internal/Context",
15+
},
16+
{
17+
text: "Events",
18+
link: "/Lagrange.Core/Internal/Events",
19+
},
20+
{
21+
text: "Logic",
22+
link: "/Lagrange.Core/Internal/Logic",
23+
},
24+
{
25+
text: "Network",
26+
link: "/Lagrange.Core/Internal/Network",
27+
},
28+
{
29+
text: "Packets",
30+
link: "/Lagrange.Core/Internal/Packets",
31+
},
32+
{
33+
text: "Services",
34+
link: "/Lagrange.Core/Internal/Services",
35+
}
36+
]
837
}
938
],
1039
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Context
2+
这里定义了多种用途的Context,所谓Context,即是需要长期持有的状态。
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Protocol Events
2+
`Lagrange.Core` 是一个事件驱动的系统。在上层,每一种API调用操作本质上都是组装一个事件,然后在系统的Logic, Service, Context中层层转发,最终变成通过Socket发送出去的字节流;而收到的回复或者推送也是同样地层层上递,最终解析为`Protocol Event`处理的。
3+
4+
在这里按照语义定义了多种`Protocol Event`,分为登录事件、系统事件和消息事件。
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Logic
2+
这里定义的`Logic`主要负责将订阅的`protocol event`进行处理,调用`Context`或者递出事件。
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Network
2+
这里定义了一些网络相关的工具类和函数。
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Packets
2+
`Lagrange.Core`将事件层层封装为Packet然后发送。首先,是`protobuf`包,然后,将会被封装为`SSO Packet`, 最终会被封装为不同版本(12/13)的`UniPacket`封装。
3+
4+
在协议上可以参考腾讯的[Tars](https://tarscloud.github.io/TarsDocs/base/tars-tup.html)。其为`TRPC`的早期开源版本,暴露了更多细节。
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Service
2+
`Service`是RPC中对于远端服务的抽象,相当于`grpc`中的`service`

0 commit comments

Comments
 (0)