-
Notifications
You must be signed in to change notification settings - Fork 874
Description
Regarding the two core interfaces in the Kitex repository, remote.Message and rpcinfo.RPCInfo, developers often have difficulty clearly distinguishing between them. The purpose of this proposal is to clarify the definitions of these two interfaces and adjust the related interfaces to meet these definitions.
For rpcinfo.RPCInfo, we define its scope as encompassing a complete RPC lifecycle. Therefore, all information associated with a single RPC call sharing the same lifecycle should be placed within the RPCInfo.
For remote.Message, we define its scope of applicability to cover a single message. This includes, for example, a one-way message in a ping-pong pattern, or a single stream message in streaming mode. Consequently, information bound to the lifetime of an individual message should be defined on the remote.Message.
Based on this premise, we will make the following adjustments to the definitions of the two interfaces above:
- Remove
ServiceInfo()andSpecifyServiceInfo(svcName, methodName string)fromremote.Message, because they're not related to a message, but to an rpcinfo. The more important reason is that message does not need to retain the ServiceInfo interface, because most calls to this interface are for obtaining MethodInfo, but MethodInfo can be set into rpcinfo. - Remove
ProtocolInfo()andSetProtocolInfo(ProtocolInfo)fromremote.Message, because they're redundant to the definition of rpcinfo. - Add
ServiceInfo()andMethodInfo()torpcinfo.RPCInfo, since these two pieces of information can be directly obtained through rpcinfo, so it can reduce the cost of obtaining service and method info in the code under the scenario of multi-services with generic call.