You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/05/27 06:42:29 UTC

[GitHub] [dubbo-go] cvictory commented on a change in pull request #537: Add attribute method into Invocation and RpcInvocation

cvictory commented on a change in pull request #537:
URL: https://github.com/apache/dubbo-go/pull/537#discussion_r430889930



##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -111,6 +113,25 @@ func (r *RPCInvocation) AttachmentsByKey(key string, defaultValue string) string
 	return defaultValue
 }
 
+// get attributes
+func (r *RPCInvocation) Attributes() map[string]interface{} {
+	return r.attributes
+}
+
+// get attribute by key. If it is not exist, it will return default value
+func (r *RPCInvocation) AttributeByKey(key string, defaultValue interface{}) interface{} {
+	r.lock.RLock()
+	defer r.lock.RUnlock()
+	if r.attributes == nil {

Review comment:
       There are two methods about NewRPCInvocation . Another one is NewRPCInvocationWithOptions.  We cannot make it init it well.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org