backend

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: GPL-3.0 Imports: 21 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAliveConnections = errors.New("No alive connections")
)

Functions

func GetEndpointConfig added in v1.2.1

func GetEndpointConfig(methodPrefix string, f reflect.StructField) structure.EndpointConfig

func GetEndpoints

func GetEndpoints(methodPrefix string, handlersStructs ...interface{}) []structure.EndpointConfig

func ResolveBody

func ResolveBody(msg *isp.Message) *proto.Value

func ResolveError

func ResolveError(err error) (s *status.Status, ok bool)

func ServerIsInitialized

func ServerIsInitialized() bool

func StartBackendGrpcServer

func StartBackendGrpcServer(addr structure.AddressConfiguration, service *DefaultService, opt ...grpc.ServerOption)

func StartBackendGrpcServerOn

func StartBackendGrpcServerOn(addr structure.AddressConfiguration, ln net.Listener, service *DefaultService, opt ...grpc.ServerOption)

func StopGrpcServer

func StopGrpcServer()

func UpdateHandlers

func UpdateHandlers(methodPrefix string, handlersStructs ...interface{})

func WrapBody

func WrapBody(value *proto.Value) *isp.Message

Types

type DefaultService

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

func GetDefaultService

func GetDefaultService(methodPrefix string, handlersStructs ...interface{}) *DefaultService

func (*DefaultService) Request

func (df *DefaultService) Request(ctx context.Context, msg *isp.Message) (*isp.Message, error)

func (*DefaultService) RequestStream

func (df *DefaultService) RequestStream(stream isp.BackendService_RequestStreamServer) error

func (*DefaultService) WithErrorHandler

func (df *DefaultService) WithErrorHandler(eh ErrorHandler) *DefaultService

func (*DefaultService) WithInterceptor added in v1.2.1

func (df *DefaultService) WithInterceptor(interceptor Interceptor) *DefaultService

func (*DefaultService) WithPostProcessors added in v1.4.0

func (df *DefaultService) WithPostProcessors(pps ...PostProcessor) *DefaultService

func (*DefaultService) WithValidator added in v1.4.0

func (df *DefaultService) WithValidator(validator Validator) *DefaultService

type ErrorHandler

type ErrorHandler func(err error) (interface{}, error)

type GrpcServer

type GrpcServer struct {
	*grpc.Server
	// contains filtered or unexported fields
}

type Interceptor added in v1.2.1

type Interceptor func(ctx RequestCtx, proceed func() (interface{}, error)) (interface{}, error)

type InternalGrpcClient

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

func NewGrpcClient

func NewGrpcClient(addr string, options ...grpc.DialOption) (*InternalGrpcClient, error)

func NewGrpcClientV2

func NewGrpcClientV2(addrList []string, errorHandler errorHandler, options ...grpc.DialOption) (*InternalGrpcClient, error)

func (*InternalGrpcClient) Close

func (client *InternalGrpcClient) Close(errorHandler errorHandler)

func (*InternalGrpcClient) CloseQuietly

func (client *InternalGrpcClient) CloseQuietly()

func (*InternalGrpcClient) Conn added in v1.1.2

func (client *InternalGrpcClient) Conn() (isp.BackendServiceClient, error)

func (*InternalGrpcClient) Invoke

func (client *InternalGrpcClient) Invoke(method string, callerId int, requestBody, responsePointer interface{}, mdPairs ...string) error

func (*InternalGrpcClient) InvokeStream added in v1.3.0

func (client *InternalGrpcClient) InvokeStream(method string, callerId int, consumer streaming.StreamConsumer) error

func (*InternalGrpcClient) WithMetric

func (client *InternalGrpcClient) WithMetric(catchMetric func(method string, dur time.Duration, err error)) *InternalGrpcClient

type PostProcessor added in v1.4.0

type PostProcessor func(ctx RequestCtx)

type RequestCtx added in v1.4.0

type RequestCtx interface {
	Method() string
	Metadata() metadata.MD
	RequestBody() []byte
	ResponseBody() []byte
	MappedRequest() interface{}
	MappedResponse() interface{}
	Error() error
}

type RxGrpcClient

type RxGrpcClient struct {
	*InternalGrpcClient
	// contains filtered or unexported fields
}

func NewRxGrpcClient

func NewRxGrpcClient(opts ...RxOption) *RxGrpcClient

func (*RxGrpcClient) Close

func (rc *RxGrpcClient) Close()

func (*RxGrpcClient) ReceiveAddressList

func (rc *RxGrpcClient) ReceiveAddressList(list []structure.AddressConfiguration) bool

func (*RxGrpcClient) Visit

func (rc *RxGrpcClient) Visit(visitor func(c *InternalGrpcClient) error) error

type RxOption

type RxOption func(rc *RxGrpcClient)

func WithDialOptions

func WithDialOptions(opts ...grpc.DialOption) RxOption

func WithDialingErrorHandler

func WithDialingErrorHandler(eh errorHandler) RxOption

func WithMetric

func WithMetric(catchMetric func(method string, dur time.Duration, err error)) RxOption

type Validator added in v1.4.0

type Validator func(ctx RequestCtx, mappedRequestBody interface{}) error

Jump to

Keyboard shortcuts

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