app

package
v0.0.0-...-83fd405 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ActorName = "app"
View Source
const ConfigName = "app"

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	*nactor.Actor
	// contains filtered or unexported fields
}

func New

func New(cfg nexport.IAppConfig, logger nlog.ILogger) (app *App)

func (*App) GetConfig

func (a *App) GetConfig() nexport.IAppConfig

func (*App) GetID

func (a *App) GetID() nexport.ServiceID

func (*App) Run

func (a *App) Run() (err error)

type Config

type Config struct {
	ID                       nexport.AppID
	PprofIP                  string           // pprof监听IP,禁止用公网IP
	PprofPort                int              // pprof监听端口
	EndpointIP               string           // RPC监听IP,禁止用公网IP
	EndpointPort             int              // RPC监听端口
	Services                 []*ServiceConfig // 承载的服务,按顺序启动
	LogDir                   string           // 日志目录
	StartServiceIntervalMSec time.Duration    // 启动服务的间隔毫秒
	StopServiceIntervalMSec  time.Duration    // 停止服务的间隔毫秒
	ExitWaitSec              time.Duration    // 进程退出等待秒数
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func NewConfig

func NewConfig() *Config

func (*Config) AddServiceConfig

func (c *Config) AddServiceConfig(serviceConfig nexport.IServiceConfigInApp)

func (Config) Clone

func (c Config) Clone() nexport.IServiceConfig

func (*Config) EachServiceConfig

func (c *Config) EachServiceConfig(fn func(i int, serviceConfig nexport.IServiceConfigInApp) (continued bool))

func (Config) GetEndpointIP

func (c Config) GetEndpointIP() string

func (Config) GetEndpointPort

func (c Config) GetEndpointPort() int

func (Config) GetExitWaitSec

func (c Config) GetExitWaitSec() time.Duration

func (Config) GetID

func (c Config) GetID() nexport.AppID

func (Config) GetLogDir

func (c Config) GetLogDir() string

func (Config) GetPprofIP

func (c Config) GetPprofIP() string

func (Config) GetPprofPort

func (c Config) GetPprofPort() int

func (*Config) GetServiceConfigByIndex

func (c *Config) GetServiceConfigByIndex(index int) (serviceConfig nexport.IServiceConfigInApp, ok bool)

func (Config) GetStartServiceIntervalMSec

func (c Config) GetStartServiceIntervalMSec() time.Duration

func (Config) GetStopServiceIntervalMSec

func (c Config) GetStopServiceIntervalMSec() time.Duration

func (*Config) SetEndpointIP

func (c *Config) SetEndpointIP(endpointIP string)

func (*Config) SetEndpointPort

func (c *Config) SetEndpointPort(endpointPort int)

func (*Config) SetExitWaitSec

func (c *Config) SetExitWaitSec(exitWaitSecond time.Duration)

func (*Config) SetID

func (c *Config) SetID(id nexport.AppID)

func (*Config) SetLogDir

func (c *Config) SetLogDir(logDir string)

func (*Config) SetPprofIP

func (c *Config) SetPprofIP(pprofIP string)

func (*Config) SetPprofPort

func (c *Config) SetPprofPort(pprofPort int)

func (*Config) SetStartServiceIntervalMSec

func (c *Config) SetStartServiceIntervalMSec(startServiceIntervalMSec time.Duration)

func (*Config) SetStopServiceIntervalMSec

func (c *Config) SetStopServiceIntervalMSec(stopServiceIntervalMSec time.Duration)

func (*Config) TidyAndCheck

func (c *Config) TidyAndCheck() error

type ServiceConfig

type ServiceConfig struct {
	Name string
	ID   int
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func NewServiceConfig

func NewServiceConfig() *ServiceConfig

func (ServiceConfig) Clone

func (ServiceConfig) GetID

func (cfg ServiceConfig) GetID() int

func (ServiceConfig) GetName

func (cfg ServiceConfig) GetName() string

Jump to

Keyboard shortcuts

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