package
Version:
v0.0.0-...-103f554
Opens a new window with list of versions in this module.
Published: Oct 22, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
简单IPC(进程间通信)框架的目的很简单,就是封装通信包的编码细节,让使用者可以专
注于业务。我们这里用channel作为模块之间的通信方式。虽然channel可以传递任何数据类型,
甚至包括另外一个channel,但为了让我们的架构更容易分拆,我们还是严格限制了只能用于传递
JSON格式的字符串类型数据。这样如果之后想将这样的单进程示例修改为多进程的分布式架构,
也不需要全部重写,只需替换通信层即可。
Documentation
¶
type IpcServer struct {
Server
}
IpcServer ipc结构体
type Request struct {
Method string `json:"method"`
Params string `json:"params"`
}
Request 请求结构体
type Response struct {
Code int `json:"code"`
Body string `json:"body"`
}
Response 服务处理响应结构体
Source Files
¶
Click to show internal directories.
Click to hide internal directories.