grpc

package
v0.9.70 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InterceptorPriorityPreprocess     = 1
	InterceptorPriorityObservability  = 2
	InterceptorPriorityAuthentication = 3
	InterceptorPriorityBusinessLogic  = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Server)

func WitHealthCheckCtx

func WitHealthCheckCtx(ctx context.Context) Option

WitHealthCheckCtx sets the health-check context. Once context is canceled, health-check will return error.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets the logger.

func WithMaxRecvMsgSize

func WithMaxRecvMsgSize(size int) Option

WithMaxRecvMsgSize sets the maximum receive message size.

func WithMaxSendMsgSize

func WithMaxSendMsgSize(size int) Option

WithMaxSendMsgSize sets the maximum send message size.

func WithRateLimiter

func WithRateLimiter(rate int, burst int) Option

WithRateLimiter enables/disables rate limiting.

func WithReflection

func WithReflection(enabled bool) Option

WithReflection enables/disables reflection.

func WithStreamInterceptor

func WithStreamInterceptor(priority int, interceptor grpc.StreamServerInterceptor) Option

WithStreamInterceptor adds a stream interceptor with a specific priority.

func WithTracing

func WithTracing(enabled bool) Option

WithTracing enables/disables tracing.

func WithUnaryInterceptor

func WithUnaryInterceptor(priority int, interceptor grpc.UnaryServerInterceptor) Option

WithUnaryInterceptor adds a unary interceptor with a specific priority.

type PermissionRegistry

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

PermissionRegistry hold list of permissions for each grpc method. It is responsibility of the adapter to register permissions.

func NewPermissionRegistry

func NewPermissionRegistry() *PermissionRegistry

func (*PermissionRegistry) PermissionsForMethod

func (pr *PermissionRegistry) PermissionsForMethod(method string) []string

func (*PermissionRegistry) Register

func (pr *PermissionRegistry) Register(method string, permissions ...string)

type Server

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

func New

func New(opts ...Option) *Server

func (*Server) Register

func (s *Server) Register(adapters ...adapterAccessor)

func (*Server) Serve

func (s *Server) Serve(listen string) error

func (*Server) Shutdown

func (s *Server) Shutdown(_ context.Context) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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