Documentation ¶
Index ¶
- type BackgroundServer
- type Middleware
- type MiddlewareComposer
- func (mc *MiddlewareComposer) ExtendContext(baseCtx context.Context, newCtxMetadata RequestContextMetadata) context.Context
- func (mc *MiddlewareComposer) PassToNext(m ...Middleware) Middleware
- func (mc *MiddlewareComposer) Register(filter string, mw ...Middleware)
- func (mc *MiddlewareComposer) Search(requestPath string) []Middleware
- type Options
- type RequestContextMetadata
- type RequestHandler
- type ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddAdditionalGrpcOptions(grpcOpts ...grpc.ServerOption) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddAddress(a string) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddCustomUnaryMiddlewares(filter string, mwList ...Middleware) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddGrpcStreamInterceptors(streamInter ...grpc.StreamServerInterceptor) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddGrpcUnaryInterceptors(unaryInter ...grpc.UnaryServerInterceptor) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddListener(l net.Listener) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddNetwork(n string) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddServicesHealthChecks(srv map[string]func() grpc_health_v1.HealthCheckResponse_ServingStatus) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) AddShutdownTimeout(t time.Duration) *ServerOptionsBuilder
- func (b *ServerOptionsBuilder) Build() []Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundServer ¶
BackgroundServer wrapper
func (*BackgroundServer) GetSeverity ¶
func (s *BackgroundServer) GetSeverity() background.ProcessSeverity
GetSeverity of the task
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
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
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
func (b *ServerOptionsBuilder) AddAddress(a string) *ServerOptionsBuilder
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
func (b *ServerOptionsBuilder) AddListener(l net.Listener) *ServerOptionsBuilder
AddListener custom value
func (*ServerOptionsBuilder) AddNetwork ¶ added in v0.4.0
func (b *ServerOptionsBuilder) AddNetwork(n string) *ServerOptionsBuilder
AddNetwork type that will be used in gRPC server
func (*ServerOptionsBuilder) AddServicesHealthChecks ¶ added in v0.4.0
func (b *ServerOptionsBuilder) AddServicesHealthChecks(srv map[string]func() grpc_health_v1.HealthCheckResponse_ServingStatus) *ServerOptionsBuilder
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