invocation

package
v1.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 4 Imported by: 20

Documentation

Index

Constants

View Source
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 {
	HandlerIndex       int
	Endpoint           string //service's ip and port, it is decided in load balancing
	Protocol           string
	Port               string //Port is the name of a real service port
	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 chassis 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) GetMark added in v1.8.1

func (inv *Invocation) GetMark() string

GetMark return match rule name that request matches

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) Mark added in v1.8.1

func (inv *Invocation) Mark(matchRuleName string)

Mark marks a invocation, it means the invocation matches a match rule so that governance rule can be applied to invocation with specific mark

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

type Response added in v0.7.1

type Response struct {
	Status int
	Result interface{}
	Err    error
}

Response is invocation response struct

type ResponseCallBack

type ResponseCallBack func(*Response) error

ResponseCallBack process invocation response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL