Documentation ¶
Index ¶
Constants ¶
const ( Consumer = iota Provider )
constant values for consumer and provider
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Invocation ¶
type Invocation struct { Endpoint string //service's ip and port, it is decided in load balancing Protocol string SourceServiceID string SourceMicroService string MicroServiceName string //Target micro service name SchemaID string //correspond struct name OperationID string //correspond struct func name Args interface{} URLPathFormat string Reply interface{} Ctx context.Context //ctx can save protocol headers Metadata map[string]interface{} //local scope data RouteTags utiltags.Tags //route tags is decided in router handler Strategy string //load balancing strategy Filters []string }
Invocation is the basic struct that used in go sdk to make client and transport layer transparent . developer should implements a client which is able to transfer invocation to there own request a protocol server should transfer request to invocation and then back to request
func New ¶ added in v0.7.1
func New(ctx context.Context) *Invocation
New create invocation, context can not be nil if you don't set ContextHeaderKey, then New will init it
func (*Invocation) GetSessionID ¶ added in v0.7.1
func (inv *Invocation) GetSessionID() string
GetSessionID return session id
func (*Invocation) Headers ¶ added in v0.7.1
func (inv *Invocation) Headers() map[string]string
Headers return a map that protocol plugin should deliver in transport
func (*Invocation) Reset ¶ added in v0.7.1
func (inv *Invocation) Reset()
Reset reset clear a invocation
func (*Invocation) SetHeader ¶ added in v0.7.1
func (inv *Invocation) SetHeader(k, v string)
SetHeader set headers, the client and server plugins should use them in protocol headers it is convenience but has lower performance than you use Headers[k]=v, when you have a batch of kv to set
func (*Invocation) SetMetadata ¶ added in v0.7.1
func (inv *Invocation) SetMetadata(key string, value interface{})
SetMetadata local scope params
func (*Invocation) SetSessionID ¶ added in v0.7.1
func (inv *Invocation) SetSessionID(value string)
SetSessionID set session id to invocation
type ResponseCallBack ¶
ResponseCallBack process invocation response