backend

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: GPL-3.0 Imports: 24 Imported by: 7

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.EndpointDescriptor

Deprecated

func GetEndpoints

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

Deprecated

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{}) error

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

Deprecated

func NewDefaultService

func NewDefaultService(descriptors []structure.EndpointDescriptor) *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{}, opts ...InvokeOption) error

func (*InternalGrpcClient) InvokeStream added in v1.3.0

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

func (*InternalGrpcClient) InvokeWithDynamicStruct added in v1.6.3

func (client *InternalGrpcClient) InvokeWithDynamicStruct(method string, callerId int, requestBody interface{}, opts ...InvokeOption) (interface{}, error)

func (*InternalGrpcClient) WithMetric

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

type InvokeOption added in v1.9.0

type InvokeOption func(opts *invokeOpts)

func WithMetadata added in v1.9.0

func WithMetadata(md metadata.MD) InvokeOption

func WithTimeout added in v1.9.0

func WithTimeout(timeout time.Duration) InvokeOption

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