Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// service properties
AppName string
ConfigFileName string
CustomConfigPath string
// web server config
WebServerConfig *WebServerConfig
RegisterServiceHandlers func(grpcServer *grpc.Server)
// setup optional health check handlers
DefaultHealthCheckHandler func(ctx context.Context) grpc_health_v1.HealthCheckResponse_ServingStatus
ServiceHealthCheckHandlers map[string]func(ctx context.Context) grpc_health_v1.HealthCheckResponse_ServingStatus
// setup optional rate limit server interceptor
RateLimit ratelimiter.RateLimiterIFace
// one or more unary server interceptors for handling wrapping actions
UnaryServerInterceptors []grpc.UnaryServerInterceptor
// one or more stream server interceptors for handling wrapping actions
StreamServerInterceptors []grpc.StreamServerInterceptor
// typically wrapper action to handle monitoring
StatsHandler stats.Handler
// handler for unknown requests rather than sending back an error
UnknownStreamHandler grpc.StreamHandler
// handler to invoke before gRPC server is to start
BeforeServerStart func(svc *Service)
// handler to invoke after gRPC server started
AfterServerStart func(svc *Service)
// handler to invoke before gRPC server is to shutdown
BeforeServerShutdown func(svc *Service)
// handler to invoke after gRPC server has shutdown
AfterServerShutdown func(svc *Service)
// contains filtered or unexported fields
}
Service represents a gRPC server's service definition and entry point
func NewService ¶
func NewService(appName string, configFileName string, customConfigPath string, registerServiceHandlers func(grpcServer *grpc.Server)) *Service
create service
func (*Service) CurrentlyServing ¶
CurrentlyServing indicates if this service health status indicates currently serving mode or not
func (*Service) GracefulStop ¶
func (s *Service) GracefulStop()
GracefulStop allows existing actions be completed before shutting down gRPC server
func (*Service) ImmediateStop ¶
func (s *Service) ImmediateStop()
ImmediateStop will forcefully shutdown gRPC server regardless of pending actions being processed
func (*Service) LocalAddress ¶
LocalAddress returns the service server's address and port
type WebServerConfig ¶ added in v1.0.6
type WebServerConfig struct {
AppName string
ConfigFileName string
CustomConfigPath string
// define web server router info
WebServerRoutes map[string]*ginw.RouteDefinition
// getter only
WebServerLocalAddress string
// clean up func
CleanUp func()
}
func (*WebServerConfig) GetWebServerLocalAddress ¶ added in v1.0.7
func (w *WebServerConfig) GetWebServerLocalAddress() string
GetWebServerLocalAddress returns FQDN url to the local web server
Click to show internal directories.
Click to hide internal directories.