serviceinfo

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 728

Documentation

Index

Constants

View Source
const (
	// GenericService name
	GenericService = "$GenericService" // private as "$"
	// GenericMethod name
	GenericMethod = "$GenericCall"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MethodHandler

type MethodHandler func(ctx context.Context, handler, args, result interface{}) error

MethodHandler is corresponding to the handler wrapper func that in generated code

type MethodInfo

type MethodInfo interface {
	Handler() MethodHandler
	NewArgs() interface{}
	NewResult() interface{}
	OneWay() bool
}

MethodInfo to record meta info of unary method

func NewMethodInfo

func NewMethodInfo(methodHandler MethodHandler, newArgsFunc, newResultFunc func() interface{}, oneWay bool) MethodInfo

NewMethodInfo is called in generated code to build method info

type PayloadCodec

type PayloadCodec int

PayloadCodec alias type

const (
	Thrift PayloadCodec = iota
	Protobuf
)

PayloadCodec supported by kitex.

func (PayloadCodec) String

func (p PayloadCodec) String() string

String prints human readable information.

type ServiceInfo

type ServiceInfo struct {
	// deprecated, for compatibility
	PackageName string

	// The name of the service. For generic services, it is always the constant `GenericService`.
	ServiceName string

	// HandlerType is the type value of a request handler from the generated code.
	HandlerType interface{}

	// Methods contains the meta information of methods supported by the service.
	// For generic service, there is only one method named by the constant `GenericMethod`.
	Methods map[string]MethodInfo

	// PayloadCodec is the codec of payload.
	PayloadCodec PayloadCodec

	// KiteXGenVersion is the version of command line tool 'kitex'.
	KiteXGenVersion string

	// Extra is for future feature info, to avoid compatibility issue
	// as otherwise we need to add a new field in the struct
	Extra map[string]interface{}
}

ServiceInfo to record meta info of service

func (*ServiceInfo) GetPackageName

func (i *ServiceInfo) GetPackageName() (pkg string)

GetPackageName returns the PackageName. The return value is generally taken from the Extra field of ServiceInfo with a key `PackageName`. For some legacy generated code, it may come from the PackageName field.

func (*ServiceInfo) MethodInfo

func (i *ServiceInfo) MethodInfo(name string) MethodInfo

MethodInfo gets MethodInfo.

Jump to

Keyboard shortcuts

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