Documentation ¶
Overview ¶
Package service outlines the Magma microservices framework. The framework helps to create a microservice easily, and provides the common service logic like service303, config, etc.
Index ¶
- Constants
- func GetDefaultKeepaliveParameters() keepalive.ServerParameters
- type Service
- func (service *Service) GetMetrics(ctx context.Context, void *protos.Void) (*protos.MetricsContainer, error)
- func (service *Service) GetOperationalStates(ctx context.Context, void *protos.Void) (*protos.GetOperationalStatesResponse, error)
- func (service *Service) GetServiceInfo(ctx context.Context, void *protos.Void) (*protos.ServiceInfo, error)
- func (service *Service) ReloadServiceConfig(ctx context.Context, void *protos.Void) (*protos.ReloadConfigResponse, error)
- func (service *Service) Run() error
- func (service *Service) RunTest(lis net.Listener)
- func (service *Service) SetLogLevel(ctx context.Context, logLevelMsg *protos.LogLevelMessage) (*protos.Void, error)
- func (service *Service) SetLogVerbosity(ctx context.Context, verbosity *protos.LogVerbosity) (*protos.Void, error)
- func (service *Service) StopService(ctx context.Context, void *protos.Void) (*protos.Void, error)
Constants ¶
const ( PrintGrpcPayloadFlag = "print-grpc-payload" PrintGrpcPayloadEnv = "MAGMA_PRINT_GRPC_PAYLOAD" )
Variables ¶
This section is empty.
Functions ¶
func GetDefaultKeepaliveParameters ¶
func GetDefaultKeepaliveParameters() keepalive.ServerParameters
GetDefaultKeepaliveParameters returns the default keepalive server parameters.
Types ¶
type Service ¶
type Service struct { // Type identifies the service Type string // GrpcServer runs on the port specified in the registry. // Services can attach different servicers to the GrpcServer. GrpcServer *grpc.Server // Version of the service Version string // State of the service State protos.ServiceInfo_ServiceState // Health of the service Health protos.ServiceInfo_ApplicationHealth // Start time of the service StartTimeSecs uint64 // Config of the service Config *config.ConfigMap }
func NewServiceWithOptions ¶
func NewServiceWithOptions(moduleName string, serviceName string, serverOptions ...grpc.ServerOption) (*Service, error)
NewServiceWithOptions returns a new GRPC orchestrator service implementing service303 with the specified grpc server options. It will not instantiate the service with the identity checking middleware.
func NewServiceWithOptionsImpl ¶
func NewServiceWithOptionsImpl(moduleName string, serviceName string, serverOptions ...grpc.ServerOption) (*Service, error)
NewServiceWithOptionsImpl returns a new GRPC service implementing service303 with the specified grpc server options. This will not instantiate the service with the identity checking middleware.
func (*Service) GetMetrics ¶
func (service *Service) GetMetrics(ctx context.Context, void *protos.Void) (*protos.MetricsContainer, error)
GetMetrics returns a MetricsContainer with all metrics for the service.
func (*Service) GetOperationalStates ¶
func (service *Service) GetOperationalStates(ctx context.Context, void *protos.Void) (*protos.GetOperationalStatesResponse, error)
GetOperationalStates not currently implemented for go services
func (*Service) GetServiceInfo ¶
func (service *Service) GetServiceInfo(ctx context.Context, void *protos.Void) (*protos.ServiceInfo, error)
GetServiceInfo returns service-level info (name, version, status, etc...)
func (*Service) ReloadServiceConfig ¶
func (service *Service) ReloadServiceConfig(ctx context.Context, void *protos.Void) (*protos.ReloadConfigResponse, error)
ReloadServiceConfig not currently implemented for cloud services
func (*Service) Run ¶
Run the service. This function blocks until its interrupted by a signal or until the gRPC server is stopped.
func (*Service) RunTest ¶
RunTest runs the test service on a given Listener. This function blocks by a signal or until the gRPC server is stopped.
func (*Service) SetLogLevel ¶
func (service *Service) SetLogLevel(ctx context.Context, logLevelMsg *protos.LogLevelMessage) (*protos.Void, error)
SetLogLevel sets the logging level for the service.
func (*Service) SetLogVerbosity ¶
func (service *Service) SetLogVerbosity(ctx context.Context, verbosity *protos.LogVerbosity) (*protos.Void, error)
SetLogVerbosity sets the glog logging verbosity for the service.