Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecoderErr ¶
DecoderErr wraps another error returned by the inner decoder
func (*DecoderErr) Error ¶
func (d *DecoderErr) Error() string
func (*DecoderErr) Unwrap ¶
func (d *DecoderErr) Unwrap() error
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is a raw file source. Errors reported by the wrapped decoder will be reported wrapped in a DecoderErr with the error and file-path populated.
type StdLogger ¶
type StdLogger interface { Printf(string, ...interface{}) Print(...interface{}) }
StdLogger is an interface satisified by several logging types, including the stdlib `log.Logger`, and `github.com/rs/zerolog.Logger`, and should be trivial enough to wrap in other cases.
type WatchOpt ¶
type WatchOpt func(*WatchOpts)
WatchOpt functions mutate the state of a WatchOpts, providing optional arguments to NewWatchingSource
func WithLogger ¶
WithLogger sets a logger on the new WatchingSource.
func WithPollInterval ¶
WithPollInterval configures the new WatchingSource to use a fallback ticker to trigger polling for changes to files.
func WithSignalChannel ¶
WithSignalChannel configures the new WatchingSource to use the provided channel as a manual trigger for rereading the config file (useful with SIGHUP).
type WatchOpts ¶
type WatchOpts struct {
// contains filtered or unexported fields
}
WatchOpts contains options, which can be mutated by a WatchOpt
type WatchingSource ¶
type WatchingSource struct { Source Reload chan os.Signal PollInterval time.Duration WG sync.WaitGroup // contains filtered or unexported fields }
WatchingSource uses fsnotify (inotify, dtrace, etc) to watch for changes to a file Errors reported by the wrapped decoder will be reported wrapped in a DecoderErr with the error and file-path populated.
func NewWatchingSource ¶
func NewWatchingSource( path string, decoder dials.Decoder, opts ...WatchOpt, ) (*WatchingSource, error)
NewWatchingSource creates a new file watching source that will reload and notify if the file is updated.