Documentation ¶
Index ¶
- func InstallMonitorOptionsWatchDog(dog func(cc *MonitorOptions))
- type DiskMonitor
- type DiskNotifier
- type DiskNotifierChangeFunc
- type MonitorOption
- func WithFileExt(v string) MonitorOption
- func WithLogger(v *zaplog.Logger) MonitorOption
- func WithNotifier(v DiskNotifier) MonitorOption
- func WithPaths(v ...string) MonitorOption
- func WithRetryInterval(v time.Duration) MonitorOption
- func WithRetryLimit(v int) MonitorOption
- func WithStoper(v app.Stoper) MonitorOption
- type MonitorOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallMonitorOptionsWatchDog ¶
func InstallMonitorOptionsWatchDog(dog func(cc *MonitorOptions))
InstallMonitorOptionsWatchDog install watch dog
Types ¶
type DiskMonitor ¶
type DiskMonitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func NewMonitor(opt ...MonitorOption) *DiskMonitor
func (*DiskMonitor) Monitor ¶
func (dm *DiskMonitor) Monitor(fileOrDir string) error
Monitor 监控文件或者目录变化
func (*DiskMonitor) Start ¶
func (dm *DiskMonitor) Start() (err error)
func (*DiskMonitor) Stop ¶
func (dm *DiskMonitor) Stop()
type DiskNotifier ¶
type DiskNotifier interface { Prepare(logger *zaplog.Logger, fileName string) Change(logger *zaplog.Logger, fileName string, data []byte) error Finish(logger *zaplog.Logger, fileName string) }
DiskNotifier 磁盘监控变动接口
type DiskNotifierChangeFunc ¶
DiskNotifierChangeFunc 监控文件变化函数
type MonitorOption ¶
type MonitorOption func(cc *MonitorOptions) MonitorOption
MonitorOption option define
type MonitorOptions ¶
type MonitorOptions struct { // log interface Logger *zaplog.Logger // file ext FileExt string // monitor file or paths Paths []string // retry time limit, 0:disable retry RetryLimit int // retry interval RetryInterval time.Duration // monitor notify interface Notifier DiskNotifier // app stopper Stoper app.Stoper }
MonitorOption use for process
func NewMonitorOptions ¶
func NewMonitorOptions(opts ...MonitorOption) *MonitorOptions
NewMonitorOptions create options instance.
func (*MonitorOptions) ApplyOption ¶
func (cc *MonitorOptions) ApplyOption(opts ...MonitorOption)
ApplyOption modify options
func (*MonitorOptions) GetSetOption ¶
func (cc *MonitorOptions) GetSetOption(opt MonitorOption) MonitorOption
GetSetOption modify and get last option
func (*MonitorOptions) SetOption ¶
func (cc *MonitorOptions) SetOption(opt MonitorOption)
SetOption modify options
Click to show internal directories.
Click to hide internal directories.