Documentation ¶
Index ¶
- Constants
- type Component
- type Server
- func (s *Server) AddMux(scope permission.VisibleScope, rpcPort, gatewayPort uint16) error
- func (s *Server) Context() context.Context
- func (s *Server) GetGRPCServer(scope permission.VisibleScope) []*grpc.Server
- func (s *Server) GetGatewayMux(scope permission.VisibleScope) []*runtime.ServeMux
- func (s *Server) Handle(scope permission.VisibleScope, pattern string, handler http.Handler)
- func (s *Server) HandleFunc(scope permission.VisibleScope, pattern string, handler http.HandlerFunc)
- func (s *Server) Register(comp Component, rpcs ...string) error
- func (s *Server) Serve(isolate ...bool) error
- func (s *Server) StreamInterceptor() grpc.StreamServerInterceptor
- func (s *Server) UnaryInterceptor() grpc.UnaryServerInterceptor
- type ServerOption
- type Service
Constants ¶
View Source
const ( DefaultClientRpcPort = 8080 DefaultClientGatewayPort = 8081 DefaultServerRpcPort = 8088 DefaultServerGatewayPort = 8089 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component interface { // Name returns the component name. Name() string // Init component. Init(configure.Configure) error // InitStorage entry. InitStorage(storage.Storage) error // RegisterHandler registers HTTP handler. RegisterHandler(outer, inner *http.ServeMux) error // RegisterService registers the service. RegisterService(service.Authenticator, service.Implementor) error // RunQueueWorker will run the registered queue consumers. RunQueueWorker(queue.Queue) error // ScheduleCronTask schedules the cron tasks. ScheduleCronTask(task.Task) error }
Component interface.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddMux ¶
func (s *Server) AddMux(scope permission.VisibleScope, rpcPort, gatewayPort uint16) error
func (*Server) GetGRPCServer ¶
func (s *Server) GetGRPCServer(scope permission.VisibleScope) []*grpc.Server
GetGRPCServer returns gRPC server of the specified visible scope.
func (*Server) GetGatewayMux ¶
func (s *Server) GetGatewayMux(scope permission.VisibleScope) []*runtime.ServeMux
GetGatewayMux returns gateway mux of the specified visible scope.
func (*Server) Handle ¶
func (s *Server) Handle(scope permission.VisibleScope, pattern string, handler http.Handler)
func (*Server) HandleFunc ¶
func (s *Server) HandleFunc(scope permission.VisibleScope, pattern string, handler http.HandlerFunc)
func (*Server) StreamInterceptor ¶
func (s *Server) StreamInterceptor() grpc.StreamServerInterceptor
StreamInterceptor returns the stream server interceptor for local gateway handler server.
func (*Server) UnaryInterceptor ¶
func (s *Server) UnaryInterceptor() grpc.UnaryServerInterceptor
UnaryInterceptor returns the unary server interceptor for local gateway handler server.
type ServerOption ¶
type ServerOption func(*Server)
func WithContext ¶
func WithContext(ctx context.Context) ServerOption
func WithDefaultClientMux ¶
func WithDefaultClientMux() ServerOption
func WithDefaultServerMux ¶
func WithDefaultServerMux() ServerOption
func WithKeepAliveTTL ¶
func WithKeepAliveTTL(ttl time.Duration) ServerOption
func WithMux ¶
func WithMux(scope permission.VisibleScope, rpcPort, gatewayPort uint16) ServerOption
type Service ¶
type Service interface { service.Implementor // Handle registers the scoped http handler. Handle(scope permission.VisibleScope, pattern string, handler http.Handler) // HandleFunc registers the scoped http handle function. HandleFunc(scope permission.VisibleScope, pattern string, handler http.HandlerFunc) // AddMux adds scoped ServeMux. AddMux(permission.VisibleScope, uint16, uint16) error // Register component. Register(Component, ...string) error // Serve start the mux server. Serve(isolate ...bool) error }
func NewServer ¶
func NewServer(opts ...ServerOption) Service
Click to show internal directories.
Click to hide internal directories.