grpc

package
v0.5.32 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertGrpcStatus added in v0.5.19

func ConvertGrpcStatus(err error) int

func MakeGRPCConnect added in v0.5.19

func MakeGRPCConnect(target string, isTLS bool, dialOptions GrpcDialOptions) (conn *grpc.ClientConn, err error)

Types

type AnswLogConfig added in v0.5.7

type AnswLogConfig struct {
	Enabled bool   `config:"enabled"`
	Path    string `config:"path"`
	Filter  string `config:"filter" valid:"oneof=all warning error"`
}

type GrpcDialOptions added in v0.5.19

type GrpcDialOptions struct {
	Authority string        `config:"authority"`
	Timeout   time.Duration `config:"timeout"`
}

type Gun

type Gun struct {
	DebugLog bool
	Conf     GunConfig
	Aggr     core.Aggregator
	core.GunDeps

	Stub     grpcdynamic.Stub
	Services map[string]desc.MethodDescriptor

	AnswLog *zap.Logger
}

func NewGun

func NewGun(conf GunConfig) *Gun

func (*Gun) Answ added in v0.5.24

func (g *Gun) Answ(method *desc.MethodDescriptor, message *dynamic.Message, metadata map[string]string, out proto.Message, grpcErr error, code int)

func (*Gun) AnswLogging added in v0.5.19

func (g *Gun) AnswLogging(logger *zap.Logger, method *desc.MethodDescriptor, request proto.Message, metadata map[string]string, response proto.Message, grpcErr error)

func (*Gun) Bind

func (g *Gun) Bind(aggr core.Aggregator, deps core.GunDeps) error

func (*Gun) Shoot

func (g *Gun) Shoot(am core.Ammo)

func (*Gun) WarmUp

func (g *Gun) WarmUp(opts *warmup.Options) (any, error)

type GunConfig

type GunConfig struct {
	Target          string            `validate:"required"`
	ReflectPort     int64             `config:"reflect_port"`
	ReflectMetadata map[string]string `config:"reflect_metadata"`
	Timeout         time.Duration     `config:"timeout"` // grpc request timeout
	TLS             bool              `config:"tls"`
	DialOptions     GrpcDialOptions   `config:"dial_options"`
	AnswLog         AnswLogConfig     `config:"answlog"`
	SharedClient    struct {
		ClientNumber int  `config:"client-number,omitempty"`
		Enabled      bool `config:"enabled"`
	} `config:"shared-client,omitempty"`
}

func DefaultGunConfig added in v0.5.7

func DefaultGunConfig() GunConfig

type Sample

type Sample struct {
	URL              string
	ShootTimeSeconds float64
}

type SharedDeps added in v0.5.22

type SharedDeps struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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