2 Star 6 Fork 5

Plato/rpc-go-backend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
stub.go 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
CloudGuan 提交于 2022-03-08 23:17 . bug: compile error
package idlrpc
import "context"
type ServiceStatus uint32
const (
SERVICE_RESOLVED ServiceStatus = iota + 1 //ready for servicing
SERVICE_UPDATING //stop receive message, wait for update
)
type (
//IStub rpc stub of service's side
IStub interface {
//GetUUID service uuid, generate by rpc-repo
GetUUID() SvcUuid
//GetServiceName service name
GetServiceName() string
//GetSignature method human-readable name
GetSignature(methodId uint32) string
//GetMutipleNum service goroutine num, read from idl keyword multiple
GetMutipleNum() uint32
//IsOneWay one way function, not send response
IsOneWay(methodId uint32) bool
// Call will trigger service's method
// return encode response buffer data and errors
Call(context.Context, uint32, []byte) ([]byte, error)
//OnAfterFork invoke by framework after spawned
//init service data or load db data in this function
OnAfterFork(ctx context.Context) bool
//OnBeforeDestroy invoke by framework before uninitialized
//clean service data in this function
OnBeforeDestroy() bool
//OnTick tick by service manager in logic tick
OnTick() bool
//GetStatus get service status
//TODO: for hot update
GetStatus() ServiceStatus
//SetStatus set service status
SetStatus(status ServiceStatus)
}
)
//StubCreator stub factory
type StubCreator func(v interface{}) IStub
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dennis-kk/rpc-go-backend.git
git@gitee.com:dennis-kk/rpc-go-backend.git
dennis-kk
rpc-go-backend
rpc-go-backend
v0.4.4

搜索帮助