Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Proposal: move service/method info from message to rpcinfo, and remove protocol info from message #1817

@jayantxie

Description

@jayantxie

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() and SpecifyServiceInfo(svcName, methodName string) from remote.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() and SetProtocolInfo(ProtocolInfo) from remote.Message, because they're redundant to the definition of rpcinfo.
  • Add ServiceInfo() and MethodInfo() to rpcinfo.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions