master

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebVersion

func DebVersion(debName string) string

DebVersion 获取当前安装的包版本

func DebVersionByService

func DebVersionByService(name string) string

DebVersionByService xunyou-nodeagent.service

func GetRemoteConf

func GetRemoteConf(ctx context.Context, cfg config.FilesConf)

GetRemoteConf 定时获取远端配置, 配合 RemotePipelines 使用 注: 当主配置变化时, 该函数会退出并重新运行

func MD5ConfigFiles

func MD5ConfigFiles() (md5 string, confFiles []string)

MD5ConfigFiles 配置文件 MD5, 有变化时重载

func MD5Files

func MD5Files(files ...string) (md5 string)

MD5Files 文件 MD5

func Main

func Main()

Main 带默认命令行参数启动

func Register

func Register(stage Stage, sf ...StageFunc)

func RegisterWithContext

func RegisterWithContext(stage Stage, sf ...ContextFunc)

func Run

func Run()

Types

type ContextFunc

type ContextFunc func(ctx context.Context)

type Stage

type Stage int
const (
	// InitStage 程序初始化, 错误时退出程序
	InitStage Stage = iota

	// RuntimeStage 配置变化重载后运行
	RuntimeStage

	// StopStage 退出程序时执行
	StopStage

	// RemoteStage 执行定时远程获取配置
	RemoteStage
)

type StageFunc

type StageFunc func() error

type Watcher

type Watcher struct {
	// 监控器标识
	Key string

	// 待监控的文件列表
	Files []string

	// 文件列表中文件内容变化时执行
	Func func()
}

Watcher 文件变化监控器

func (Watcher) Start

func (w Watcher) Start()

func (Watcher) Stop

func (w Watcher) Stop()

Jump to

Keyboard shortcuts

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