dubbo.apache.org/dubbo-go/v3@v3.1.1/protocol/invocation.go (about) 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package protocol 19 20 import ( 21 "context" 22 "reflect" 23 ) 24 25 // Invocation is a interface which is invocation for each remote method. 26 type Invocation interface { 27 // MethodName gets invocation method name. 28 MethodName() string 29 // ActualMethodName gets actual invocation method name. It returns the method name been called if it's a generic call 30 ActualMethodName() string 31 // ParameterTypeNames gets invocation parameter type names. 32 ParameterTypeNames() []string 33 // ParameterTypes gets invocation parameter types. 34 ParameterTypes() []reflect.Type 35 // ParameterValues gets invocation parameter values. 36 ParameterValues() []reflect.Value 37 // Arguments gets arguments. 38 Arguments() []interface{} 39 // Reply gets response of request 40 Reply() interface{} 41 // Attachments gets all attachments 42 43 // Invoker gets the invoker in current context. 44 Invoker() Invoker 45 // IsGenericInvocation gets if this is a generic invocation 46 IsGenericInvocation() bool 47 48 Attachments() map[string]interface{} 49 SetAttachment(key string, value interface{}) 50 GetAttachment(key string) (string, bool) 51 GetAttachmentInterface(string) interface{} 52 GetAttachmentWithDefaultValue(key string, defaultValue string) string 53 GetAttachmentAsContext() context.Context 54 55 // Attributes firstly introduced on dubbo-java 2.7.6. It is 56 // used in internal invocation, that is, it's not passed between 57 // server and client. 58 Attributes() map[string]interface{} 59 SetAttribute(key string, value interface{}) 60 GetAttribute(key string) (interface{}, bool) 61 GetAttributeWithDefaultValue(key string, defaultValue interface{}) interface{} 62 }