servmanager

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgStartService

type ArgStartService struct {
	ServiceID string
}

ArgStartService are passed to Start/StopService/Status RPC methods

type Service

type Service interface {
	// Start should handle the sercive start
	Start() error
	// Reload handles the change of config
	Reload() error
	// Shutdown stops the service
	Shutdown() error
	// IsRunning returns if the service is running
	IsRunning() bool
	// ShouldRun returns if the service should be running
	ShouldRun() bool
	// ServiceName returns the service name
	ServiceName() string
}

Service interface that describes what functions should a service implement

type ServiceManager

type ServiceManager struct {
	sync.RWMutex // lock access to any shared data
	// contains filtered or unexported fields
}

ServiceManager handles service management ran by the engine

func NewServiceManager

func NewServiceManager(cfg *config.CGRConfig, engineShutdown chan bool) *ServiceManager

NewServiceManager returns a service manager

func (*ServiceManager) AddServices

func (srvMngr *ServiceManager) AddServices(services ...Service)

AddServices adds given services

func (*ServiceManager) Call

func (srvMngr *ServiceManager) Call(ctx *context.Context, serviceMethod string, args any, reply any) error

func (*ServiceManager) GetConfig

func (srvMngr *ServiceManager) GetConfig() *config.CGRConfig

GetConfig returns the Configuration

func (*ServiceManager) GetService

func (srvMngr *ServiceManager) GetService(subsystem string) (srv Service)

GetService returns the named service

func (*ServiceManager) StartServices

func (srvMngr *ServiceManager) StartServices() (err error)

StartServices starts all enabled services

func (*ServiceManager) V1ServiceStatus

func (srvMngr *ServiceManager) V1ServiceStatus(args ArgStartService, reply *string) error

V1ServiceStatus returns the service status

func (*ServiceManager) V1StartService

func (srvMngr *ServiceManager) V1StartService(args ArgStartService, reply *string) (err error)

V1StartService starts a service with ID

func (*ServiceManager) V1StopService

func (srvMngr *ServiceManager) V1StopService(args ArgStartService, reply *string) (err error)

V1StopService shuts-down a service with ID

Jump to

Keyboard shortcuts

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