summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorILYA Khlopotov <iilyak@apache.org>2018-07-11 09:20:10 -0700
committerILYA Khlopotov <iilyak@apache.org>2018-08-08 06:22:20 -0700
commit7a2a39007284039fb2744aa441fa2fd73af23170 (patch)
tree70f0566c42788424260536c2df00856c1bce5576
parentcf65280466499d652cff1171a2039af49c5677e8 (diff)
downloadcouchdb-7a2a39007284039fb2744aa441fa2fd73af23170.tar.gz
Update documentation
-rw-r--r--src/couch_epi/README.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/couch_epi/README.md b/src/couch_epi/README.md
index 445b7837a..368ad9afd 100644
--- a/src/couch_epi/README.md
+++ b/src/couch_epi/README.md
@@ -66,6 +66,38 @@ There are also additional functions to get the same data in various formats
- `couch_epi:keys(Handle)` - returns list of configured keys
- `couch_epi:subscribers(Handle)` - return list of known subscribers
+The difference between `static_module` and `callback_module` providers is in how
+couch_epi detects the changes. `static_module` is designed for the cases when you
+have your data hardcoded in the module. For example you might have the following:
+
+```
+-export([data/0]).
+
+data() ->
+ [
+ {[complex, key, 2], [
+ {type, counter},
+ {desc, bar}
+ ]},
+ {[complex, key, 1], [
+ {type, counter},
+ {desc, updated_foo}
+ ]}
+ ].
+```
+
+The changes are detected by relying on `vsn` module attribute. Therefore we
+would notice the change only when data source module is recompiled.
+
+The `callback_module` provider uses the return value from `data/0` to detect
+changes and it is useful for cases when the data term is constructed dynamically.
+For example to cache values of CouchDB config one could use the following:
+
+```
+-export([data/0]).
+data() ->
+ config:get("dreyfus").
+```
# Function dispatch example