grpc

package
Version: v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enable bool
}

Config defines the config structure

func NewConfig

func NewConfig() *Config

NewConfig is used to init config with default values

func (*Config) IsEnabled

func (c *Config) IsEnabled() bool

IsEnabled is used to return whether the current component is enabled This attribute is required in pluggable components

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *pflag.FlagSet)

RegisterFlagsWithPrefix is used to register flags

func (*Config) Validate

func (c *Config) Validate() error

Validate is used to validate config and returns error on failure

type MethodDescGetter

type MethodDescGetter func(method string) (*desc.MethodDescriptor, bool)

MethodDescGetter is used to obtain the MethodDescriptor corresponding to a given method

type Plugin

type Plugin struct {
	logger.Logger
	// contains filtered or unexported fields
}

Plugin implements Mock for gRPC request

func New

func New(cfg *Config, methodDescGetter MethodDescGetter, logger logger.Logger, registerer prometheus.Registerer) (*Plugin, error)

New is used to init service

func (*Plugin) MockResponse

func (s *Plugin) MockResponse(ctx context.Context, mock *v1alpha1.MockAPI_Response, request *interact.Request, response *interact.Response) (abort bool, err error)

MockResponse is used to generate interact.Response according to the given MockAPI_Response and interact.Request

func (*Plugin) Name

func (s *Plugin) Name() string

Name is used to return the plugin name

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL