service

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 20 Imported by: 20

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

View Source
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

func (service *Service) Run() error

Run the service. This function blocks until its interrupted by a signal or until the gRPC server is stopped.

func (*Service) RunTest

func (service *Service) RunTest(lis net.Listener)

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.

func (*Service) StopService

func (service *Service) StopService(ctx context.Context, void *protos.Void) (*protos.Void, error)

StopService is a request to stop the service gracefully.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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