master

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigModTime 公共配置文件集最后修改时间
	ConfigModTime time.Time
)

Functions

func DebVersion

func DebVersion(debName string) string

DebVersion 获取当前安装的包版本

func DebVersionByService

func DebVersionByService(name string) string

DebVersionByService ff-app.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 ...Pipeline)

func RegisterWithContext

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

func Run

func Run()

Run 守护进程启动程序

func Start added in v0.0.10

func Start()

Start 执行程序初始化

func Stop added in v0.0.10

func Stop()

Stop 程序退出

Types

type ContextFunc

type ContextFunc func(ctx context.Context)

type Pipeline added in v0.0.10

type Pipeline interface {
	Start() error
	Runtime() error
	Stop() error
}

type Stage

type Stage int
const (
	// ConfigStage 程序启动和配置重载时优先执行
	ConfigStage Stage = iota

	// MainStage 在 ConfigStage 执行完成后执行
	MainStage

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

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