boot

package
v0.0.0-...-2828018 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION  = "v4.2.1"
	AUTHOR   = "lixy<lixy@2345.com>; cinvanlee<cinvan.lee@gmail.com>"
	FilePerm = 0644
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Args       *Args
	EnvProfile bool
	LogFile    *os.File
	LogExpire  time.Duration
	BeatFreQ   time.Duration

	LogL    *LogLauncher
	ConfigL *ProfileLauncher
	SignalL *SignalLauncher

	LFunc     []LauncherFunc
	Launchers []AgentLauncher

	Context context.Context
	Cancel  context.CancelFunc
	Wg      *sync.WaitGroup

	Handlers []common.AgentHandler

	SigBus *SignalBus
	// contains filtered or unexported fields
}

func New

func New(lfs ...LauncherFunc) *Agent

func (*Agent) Init

func (a *Agent) Init() *Agent

func (*Agent) RegisterHandler

func (a *Agent) RegisterHandler(handlers ...common.AgentHandler)

func (*Agent) Restart

func (a *Agent) Restart()

func (*Agent) ShutDown

func (a *Agent) ShutDown()

func (*Agent) Start

func (a *Agent) Start() error

func (*Agent) Stop

func (a *Agent) Stop()

type AgentLauncher

type AgentLauncher interface {
	Init(agent *Agent) error
	Run() error
	Stop()
	Shutdown()
}

type App

type App struct {
	AppId        string        `yaml:"appId"`
	Namespaces   []string      `yaml:"namespace"`
	Secret       string        `yaml:"secret"`
	Syntax       string        `yaml:"syntax"`
	PollInterval time.Duration `yaml:"pollInterval"`
	InOneFile    string        `yaml:"inOneFile"`
}

type Args

type Args struct {
	LogFile    *string
	ConfigFile *string
	Pprof      *bool
	// contains filtered or unexported fields
}

func NewArg

func NewArg() *Args

func (*Args) Init

func (a *Args) Init(agent *Agent)

type Client

type Client struct {
	Type      string        `yaml:"pollOrWatch"`
	AllInOne  bool          `yaml:"allInOne"`
	LogExpire time.Duration `yaml:"logExpire"`
	Ip        string        `yaml:"ip"`
	BeatFreQ  time.Duration `yaml:"beatFreq"`
}

type DataChan

type DataChan chan struct{}

type LauncherFunc

type LauncherFunc func(*Agent) error

func WithLauncher

func WithLauncher(launcher AgentLauncher) LauncherFunc

type LogLauncher

type LogLauncher struct {
	LogExpire time.Duration
	Logfile   *os.File
	// contains filtered or unexported fields
}

func NewLog

func NewLog() *LogLauncher

func (*LogLauncher) Init

func (l *LogLauncher) Init(agent *Agent) error

func (*LogLauncher) Run

func (l *LogLauncher) Run() error

func (*LogLauncher) Shutdown

func (l *LogLauncher) Shutdown()

func (*LogLauncher) Stop

func (l *LogLauncher) Stop()

type Profile

type Profile struct {
	Client *Client `yaml:"client"`
	Server *Server `yaml:"server"`
	Apps   []*App  `yaml:"apps"`
}

type ProfileLauncher

type ProfileLauncher struct {
	FromEnvVar    bool
	Profile       *Profile
	ProfileUpdate bool
	// contains filtered or unexported fields
}

func NewProfile

func NewProfile() *ProfileLauncher

func (*ProfileLauncher) Init

func (p *ProfileLauncher) Init(agent *Agent) error

func (*ProfileLauncher) Parse

func (p *ProfileLauncher) Parse() error

func (*ProfileLauncher) Run

func (p *ProfileLauncher) Run() error

func (*ProfileLauncher) Shutdown

func (p *ProfileLauncher) Shutdown()

func (*ProfileLauncher) Stop

func (p *ProfileLauncher) Stop()

type Server

type Server struct {
	Address string `yaml:"address"`
	Cluster string `yaml:"cluster"`
}

type SignalBus

type SignalBus struct {
	StopS    chan struct{}
	RestartS chan struct{}
}

type SignalLauncher

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

func NewSignal

func NewSignal() *SignalLauncher

func (*SignalLauncher) Init

func (s *SignalLauncher) Init(agent *Agent) error

func (*SignalLauncher) Run

func (s *SignalLauncher) Run() error

func (*SignalLauncher) Shutdown

func (s *SignalLauncher) Shutdown()

func (*SignalLauncher) Stop

func (s *SignalLauncher) Stop()

Jump to

Keyboard shortcuts

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