backend

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 25 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEndpointConfig

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) (_ error, mustLog 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

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

func (*DefaultService) WithPostProcessors

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

func (*DefaultService) WithValidator

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

type ErrorHandler

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

type GrpcClient added in v2.3.0

type GrpcClient interface {
	ReceiveAddressList([]structure.AddressConfiguration) bool
	Invoke(method string, callerId int, requestBody, responsePointer interface{}, opts ...InvokeOption) error
	InvokeStream(method string, callerId int, consumer streaming.StreamConsumer) error
	Conn() isp.BackendServiceClient
	Close() error
}

type GrpcServer

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

func (*GrpcServer) Start added in v2.3.0

func (s *GrpcServer) Start()

func (*GrpcServer) UpdateHandlers added in v2.3.0

func (s *GrpcServer) UpdateHandlers(methodPrefix string, handlersStructs ...interface{}) error

type Interceptor

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

type InvokeOption

type InvokeOption func(opts *invokeOpts)

func WithCallOptions added in v2.3.0

func WithCallOptions(callOpts ...grpc.CallOption) InvokeOption

func WithContext added in v2.5.0

func WithContext(ctx context.Context) InvokeOption

func WithMetadata

func WithMetadata(md metadata.MD) InvokeOption

func WithTimeout

func WithTimeout(timeout time.Duration) InvokeOption

type PostProcessor

type PostProcessor func(ctx RequestCtx)

type RequestCtx

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

type RxGrpcClient

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

func NewRxGrpcClient

func NewRxGrpcClient(opts ...RxOption) *RxGrpcClient

NewRxGrpcClient is incompatible with grpc.WithBlock() option

func (*RxGrpcClient) Close

func (rc *RxGrpcClient) Close() error

func (*RxGrpcClient) Conn added in v2.3.0

func (*RxGrpcClient) Invoke added in v2.3.0

func (rc *RxGrpcClient) Invoke(method string, callerId int, requestBody, responsePointer interface{}, opts ...InvokeOption) error

func (*RxGrpcClient) InvokeStream added in v2.3.0

func (rc *RxGrpcClient) InvokeStream(method string, callerId int, consumer streaming.StreamConsumer) error

func (*RxGrpcClient) ReceiveAddressList

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

type RxOption

type RxOption func(rc *RxGrpcClient)

func WithConnectionsPerAddress added in v2.3.0

func WithConnectionsPerAddress(factor int) RxOption

func WithDialOptions

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

type Validator

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