grpc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundServer

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

BackgroundServer wrapper

func NewServer

func NewServer(builder *ServerOptionsBuilder) *BackgroundServer

NewServer instance

func (*BackgroundServer) GetName

func (s *BackgroundServer) GetName() string

GetName of the task

func (*BackgroundServer) GetSeverity

func (s *BackgroundServer) GetSeverity() background.ProcessSeverity

GetSeverity of the task

func (*BackgroundServer) OnStart

func (s *BackgroundServer) OnStart(_ context.Context) error

OnStart event to be called when main loop will be started

func (*BackgroundServer) OnStop

func (s *BackgroundServer) OnStop(_ context.Context) error

OnStop event to be called when main loop will be started

type Middleware added in v0.4.0

type Middleware func(RequestHandler) RequestHandler

Middleware to do some actions between gRPC requests

type MiddlewareComposer added in v0.4.0

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

MiddlewareComposer keeps middlewares and keeps it sorted by filter

func NewMiddlewareComposer added in v0.4.0

func NewMiddlewareComposer() *MiddlewareComposer

NewMiddlewareComposer instance

func (*MiddlewareComposer) ExtendContext added in v0.4.1

func (mc *MiddlewareComposer) ExtendContext(baseCtx context.Context, newCtxMetadata RequestContextMetadata) context.Context

ExtendContext baseCtx with new RequestContextMetadata

func (*MiddlewareComposer) PassToNext added in v0.4.0

func (mc *MiddlewareComposer) PassToNext(m ...Middleware) Middleware

PassToNext delegate to next middleware to execute

func (*MiddlewareComposer) Register added in v0.4.0

func (mc *MiddlewareComposer) Register(filter string, mw ...Middleware)

Register middleware with filter

func (*MiddlewareComposer) Search added in v0.4.0

func (mc *MiddlewareComposer) Search(requestPath string) []Middleware

Search middleware that related to filtered request

type Options

type Options func(o *BackgroundServer)

Options sets options such as credentials, keepalive parameters, etc.

type RequestContextMetadata added in v0.4.1

type RequestContextMetadata struct {
	Meta       metadata.MD
	FullMethod string
}

RequestContextMetadata context data from interception

func GetContextMetadata added in v0.4.1

func GetContextMetadata(baseCtx context.Context) (meta RequestContextMetadata, isExist bool)

GetContextMetadata will try get form context.Context metadata about request from middleware during interception

type RequestHandler added in v0.4.0

type RequestHandler func(ctx context.Context, req interface{}) (interface{}, error)

RequestHandler will be invoked in the gRPC Middleware

type ServerOptionsBuilder added in v0.4.0

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

ServerOptionsBuilder sets options such as credentials, keepalive parameters, etc, related to gRPC server

func NewServerOptionsBuilder added in v0.4.0

func NewServerOptionsBuilder() *ServerOptionsBuilder

NewServerOptionsBuilder for gRPC server configuration

func (*ServerOptionsBuilder) AddAdditionalGrpcOptions added in v0.4.0

func (b *ServerOptionsBuilder) AddAdditionalGrpcOptions(grpcOpts ...grpc.ServerOption) *ServerOptionsBuilder

AddAdditionalGrpcOptions that's needed for gRPC server

func (*ServerOptionsBuilder) AddAddress added in v0.4.0

AddAddress that will be used in gRPC server endpoint

func (*ServerOptionsBuilder) AddCustomUnaryMiddlewares added in v0.4.0

func (b *ServerOptionsBuilder) AddCustomUnaryMiddlewares(filter string, mwList ...Middleware) *ServerOptionsBuilder

AddCustomUnaryMiddlewares that have first priority to intercepted request in the middlewares and forwards it to gRPC if needed filter used for calling middleware for example: - /myapp.v1.MyAppAPI/* - Middleware will be executed for all endpoints under "/myapp.v1.MyAppAPI" - /myapp.v1.MyAppAPI/OnlyThatEndpoint - Middleware will be executed only for "OnlyThatEndpoint"

func (*ServerOptionsBuilder) AddGrpcStreamInterceptors added in v0.4.0

func (b *ServerOptionsBuilder) AddGrpcStreamInterceptors(streamInter ...grpc.StreamServerInterceptor) *ServerOptionsBuilder

AddGrpcStreamInterceptors intercept the execution of a streaming RPC on the server

func (*ServerOptionsBuilder) AddGrpcUnaryInterceptors added in v0.4.0

func (b *ServerOptionsBuilder) AddGrpcUnaryInterceptors(unaryInter ...grpc.UnaryServerInterceptor) *ServerOptionsBuilder

AddGrpcUnaryInterceptors intercept the execution of a unary RPC on the server

func (*ServerOptionsBuilder) AddListener added in v0.4.0

AddListener custom value

func (*ServerOptionsBuilder) AddNetwork added in v0.4.0

AddNetwork type that will be used in gRPC server

func (*ServerOptionsBuilder) AddServicesHealthChecks added in v0.4.0

AddServicesHealthChecks to verify if gRPC working correctly as health checks

func (*ServerOptionsBuilder) AddShutdownTimeout added in v0.4.0

func (b *ServerOptionsBuilder) AddShutdownTimeout(t time.Duration) *ServerOptionsBuilder

AddShutdownTimeout for gRPC server

func (*ServerOptionsBuilder) Build added in v0.4.0

func (b *ServerOptionsBuilder) Build() []Options

Build will make sure that all needed options prepared for server

Jump to

Keyboard shortcuts

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