Add deferrable callbacks
Deferrable callbacks delay callback invocation until a
pre configured length of time has elapsed. One example
scenario where deferrable callbacks help is to avoid
oscillation when testing a condition and making callbacks
frequently.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I180c99b57ec1c9bde4da76d947a026f809341c8a
diff --git a/src/example/example.yaml b/src/example/example.yaml
index d76e3ad..899c4c8 100644
--- a/src/example/example.yaml
+++ b/src/example/example.yaml
@@ -103,14 +103,13 @@
For example for a given event, one may wish to trace multiple
messages to the systemd journal. The journal callback does not
support tracing multiple messages. To do that, define a callback
- group composed of multiple journal callbacks.
+ group composed of multiple journal callbacks.'
- This example callback group only has one member. To add more, add
- additional callbacks to the members element.'
class: callback
callback: group
members:
- example journal callback
+ - example deferred condition
- name: example count condition
description: >
@@ -138,3 +137,25 @@
countbound: 3
op: '>='
bound: 115
+
+- name: example deferred condition
+ description: >
+ 'Deferred conditions operate in the same fashion as conditional callbacks
+ with the added behavior that when the condition is tested and is met,
+ invocation of the callback is deferred by the interval specified.
+
+ When the configured time has elapsed, if the condition has not been reevaluated
+ the callback is invoked.
+
+ Any condition type can be deferred in this way by setting the defer attribute.'
+
+ class: condition
+ condition: count
+ paths: example path group
+ properties: example property group
+ defer: 1000us
+ callback: example callback group
+ countop: '>='
+ countbound: 3
+ op: '>='
+ bound: 115