substratum

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 18 Imported by: 0

README

substratum

Documentation

Index

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 service.HttpHandler) 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) AddServeMux

func (s *Server) AddServeMux(scope permission.VisibleScope, rpcPort, gatewayPort uint16) error

func (*Server) Context

func (s *Server) Context() context.Context

Context returns the service context.

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) Register

func (s *Server) Register(comp Component, rpcs ...string) error

func (*Server) Serve

func (s *Server) Serve(isolate ...bool) error

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 WithServeMux

func WithServeMux(scope permission.VisibleScope, rpcPort, gatewayPort uint16) ServerOption

type Service

type Service interface {
	service.Implementor

	// AddServeMux adds scoped ServeMux.
	AddServeMux(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

Jump to

Keyboard shortcuts

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