Commit Graph

3 Commits

Author SHA1 Message Date
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