gwmsg

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 15

Documentation

Overview

Package gwmsg defines gateway message

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutBackGwMessage

func PutBackGwMessage(sourceMsg GwMsg)

PutBackGwMessage return struct Message to sync pool, and reset all the members of Message to default.

Types

type ContextKey

type ContextKey string

ContextKey 重定义一下key类型,防止字符串定义冲突

const ContextKeyGwMessage ContextKey = "TRPC_GATEWAY_MESSAGE"

ContextKeyGwMessage 网关Msg key

type GwMsg

type GwMsg interface {
	// WithTargetService sets target service
	WithTargetService(cli *client.BackendConfig)
	// TargetService returns target service
	TargetService() *client.BackendConfig

	// WithPluginConfig sets plugin configuration
	WithPluginConfig(name string, config interface{})
	// PluginConfig returns plugin configuration, do not make concurrent calls
	PluginConfig(name string) interface{}

	// WithRouterID sets router ID
	WithRouterID(routerID string)
	// RouterID returns router ID
	RouterID() string

	// WithUpstreamLatency sets upstream latency
	WithUpstreamLatency(latency int64)
	// UpstreamLatency returns upstream latency
	UpstreamLatency() int64

	// WithUpstreamAddr sets upstream address
	WithUpstreamAddr(add string)
	// UpstreamAddr returns upstream address
	UpstreamAddr() string

	// WithUpstreamMethod sets upstream method
	WithUpstreamMethod(method string)
	// UpstreamMethod returns upstream method
	UpstreamMethod() string

	// WithUpstreamRspHead sets upstream ClientRspHead
	WithUpstreamRspHead(rspHead interface{})
	// UpstreamRspHead returns upstream ClientRspHead
	UpstreamRspHead() interface{}

	// WithTRPCClientOpts sets trpc client options
	WithTRPCClientOpts(opts []client.Option)
	// TRPCClientOpts returns trpc client options
	TRPCClientOpts() []client.Option
}

GwMsg Gateway Msg interface, used for parameter sharing

func GwMessage

func GwMessage(ctx context.Context) GwMsg

GwMessage returns the message of context.

func WithNewGWMessage

func WithNewGWMessage(ctx context.Context) (context.Context, GwMsg)

WithNewGWMessage create a new empty message, and put it into ctx

Directories

Path Synopsis
Package mock_gwmsg is a generated GoMock package.
Package mock_gwmsg is a generated GoMock package.

Jump to

Keyboard shortcuts

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