Documentation ¶
Overview ¶
Package service outlines the Magma microservices framework in the cloud. The framework helps to create a microservice easily, and provides the common service logic like service303, config, etc.
Index ¶
Constants ¶
const (
RunEchoServerFlag = "run_echo_server"
)
Variables ¶
This section is empty.
Functions ¶
func NewTestService ¶
func NewTestService(t *testing.T, moduleName string, serviceType string) (*platform_service.Service, error)
NewTestService returns a new gRPC orchestrator service without loading Orchestrator plugins from disk. This should only be used in test contexts, where plugins are registered manually.
Types ¶
type OrchestratorService ¶
type OrchestratorService struct { *platform_service.Service // EchoServer runs on the echo_port specified in the registry. // This field will be nil for services that don't specify the // 'run_echo_server' flag. EchoServer *echo.Echo }
OrchestratorService defines a service which extends the generic platform service with an optional HTTP server.
func NewOrchestratorService ¶
func NewOrchestratorService(moduleName string, serviceName string, serverOptions ...grpc.ServerOption) (*OrchestratorService, error)
NewOrchestratorService returns a new gRPC orchestrator service implementing service303. If configured, it will also initialize an HTTP echo server as a part of the service. This service will implement a middleware interceptor to perform identity check. If your service does not or can not perform identity checks, (e.g. federation), use NewServiceWithOptions.
func NewTestOrchestratorService ¶
func NewTestOrchestratorService(t *testing.T, moduleName string, serviceType string) (*OrchestratorService, error)
NewTestOrchestratorService returns a new gRPC orchestrator service without loading Orchestrator plugins from disk. This should only be used in test contexts, where plugins are registered manually.
func (*OrchestratorService) Run ¶
func (s *OrchestratorService) Run() error
Run runs the service. If the echo HTTP server is non-nil, both the HTTP server and gRPC server are run, blocking until an error occurs or a server stopped. If the HTTP server is nil, only the gRPC server is run, blocking until its interrupted by a signal or until the gRPC server is stopped.
func (*OrchestratorService) RunTest ¶
func (s *OrchestratorService) RunTest(lis net.Listener)
RunTest runs the test service on a given Listener and the HTTP on it's configured addr if exists. This function blocks by a signal or until a server is stopped.