services

package
v0.15.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProfilingService

type ProfilingService struct {
	// contains filtered or unexported fields
}

ProfilingService is a service that returns profiling information via a HTTP server.

func NewProfilingService

func NewProfilingService(address string) *ProfilingService

NewProfilingService creates a new ProfilingService instance bound to a specified address.

func (*ProfilingService) Name

func (ps *ProfilingService) Name() string

Name returns a human-readable name for a ProfilingService.

func (*ProfilingService) Serve

func (ps *ProfilingService) Serve() error

Serve runs a ProfilingService. It sets up the HTTP endpoint and services requests until the service is stopped. It runs on the calling Goroutine.

func (*ProfilingService) Stop

func (ps *ProfilingService) Stop()

Stop stops a running ProfilingService.

type Service

type Service interface {
	Name() string
	Serve() error
	Stop()
}

Service is a service that is registered with and run by a ServiceManager

type ServiceManager

type ServiceManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ServiceManager controls an arbitrary number of running services.

func NewServiceManager

func NewServiceManager(options ...ServiceManagerOption) *ServiceManager

NewServiceManager creates a new ServiceManager instance.

func (*ServiceManager) RegisterService

func (sm *ServiceManager) RegisterService(service Service)

RegisterService registers a Service for management with a ServiceManager.

func (*ServiceManager) Run

func (sm *ServiceManager) Run()

Run starts and runs all services registered with a ServiceManager. This function does not return until the ServiceManager is stopped via Stop.

func (*ServiceManager) Stop

func (sm *ServiceManager) Stop()

Stop stops a running ServiceManager. If the ServiceManager is not running, this function does nothing.

type ServiceManagerOption

type ServiceManagerOption func(*serviceManagerOptions)

ServiceManagerOption represents options passed into the service manager constructor

func WithAllOrNothing

func WithAllOrNothing() ServiceManagerOption

WithAllOrNothing specifies whether all services should exit upon a single service failure

Jump to

Keyboard shortcuts

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