2 Star 6 Fork 5

Plato/rpc-go-backend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
stub.go 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
CloudGuan 提交于 2023-10-10 12:57 . !16ISSUE: async rpc call result
package idlrpc
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
//GetMultipleNum will return the number of concurrent coroutines for the service
GetMultipleNum() uint32
//IsOneWay that returns whether the method is oneway
IsOneWay(uint32) bool
// GetTimeout will return the timeout config of the method
GetTimeout(uint32) uint32
// Call will call the microservice method and returns the serialized data with the error code
Call(IServiceContext, uint32, []byte) ([]byte, error)
// Return In non-immediate mode, the call can be returned to the sender
Return(IServiceContext, uint32, interface{}, error) ([]byte, error)
//OnAfterFork invoke by framework after spawned
//init service data or load db data in this function
OnAfterFork(IServiceContext) 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(ServiceStatus)
//OnSub will notify service sub info
OnSub(string, string, []byte) error
//OnCancel will notify subscriber remove sub
OnCancel(string, string) error
}
)
// StubCreator stub factory
type StubCreator func(v interface{}) IStub
Loading...
马建仓 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.5.12

搜索帮助