Commit graph

5 commits

Author SHA1 Message Date
Paul Stemmet be92e2c705
config: pad log level
longest that can be created is DPANIC, or 6 wide.

Upstream-Ref: https://github.com/uber-go/zap/blob/v1.24.0/zapcore/level.go#L135
2022-12-10 19:39:57 +00:00
Paul Stemmet 5f53e60ace
config: use unix epoch for time, spaces over tabs 2022-12-10 19:31:32 +00:00
Paul Stemmet 760bcac716
config: tests for WatchConfig 2022-12-09 18:05:57 +00:00
Paul Stemmet c1afc0d510
config: WatchConfig, WatchRules
These are representations of user defined rules and contextual
information, which can be used to handle notify events.

Specifically, we allow this user to provide (and later access via .Cxt)
arbitrary data under the watch.context key, while providing us rules
under watch.rules.

Each rule consists of an 'Exec' template, and three conditions for
running it (State, Type, Instance). Omitted conditions are ignored.

The Exec value consists of a golang templated command to be executed
based on the conditions listed above.

It has access to two keys, '.Event', and '.Cxt'. .Event contains the
'.Instance', '.State' and '.Type' of the event which triggered this
Exec, while '.Cxt' refers to the arbitrary watch.context passed in.
2022-12-09 18:05:57 +00:00
Paul Stemmet f0bacb8000
config: LibCxt
This is a "global" context object currently containing a cancellation
context and logger.

This struct can be considered as the lib's generic configuration, and
may be asked for in any public function.
2022-12-09 18:05:55 +00:00