Documentation ¶
Overview ¶
Package dux contains types which enable active monitoring and reloading of a program.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecEngine ¶
ExecEngine combines a command, arguments, and a watcher which triggers a reload of the command.
func (ExecEngine) Run ¶
func (e ExecEngine) Run(ctx context.Context)
Run executes ExecEngine.Cmd with ExecEngine.Args, then waits for ExecEngine.Watcher to unblock. When it does, Run kills the command and reruns it. This continues until the context is canceled. TODO: Stop Run when context is canceled
type FileWatcher ¶
FileWatcher monitors a given file system, checking all files within at the given polling frequency.
func (FileWatcher) Watch ¶
func (fw FileWatcher) Watch(ctx context.Context)
Watch monitors the FileWatcher file system for changes, blocking until either the context is canceled or a change is detected.
type FuncEngine ¶
A FuncEngine combines a function (which returns a Closer) with a Watcher which triggers that function's reload.
func (FuncEngine) Run ¶
func (e FuncEngine) Run(ctx context.Context)
Run executes FuncEngine.Func, then waits for FuncEngine.Watcher to unblock. When it does, Func's Close method is called and Func is rerun.
type TimeWatcher ¶
TimeWatcher is a Watcher that triggers at a set interval.
func (TimeWatcher) Watch ¶
func (t TimeWatcher) Watch(ctx context.Context)
Watch blocks until TimeWatcher.Delay duration passes or the context is canceled.