summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorILYA Khlopotov <iilyak@apache.org>2018-11-23 11:59:01 +0000
committerILYA Khlopotov <iilyak@apache.org>2018-11-23 18:45:49 +0000
commita60655b43ab14db5b3368b2781b47d08d5bc45c3 (patch)
treec3595b8425b92fc2ef5783a3757bbad894d46410
parent81f7904b3fcaad18f0376c72d1a71c65f9f0cadf (diff)
downloadcouchdb-a60655b43ab14db5b3368b2781b47d08d5bc45c3.tar.gz
Fix couch_epi typespec for data provider
There were few problems: - `module` was renamed into `static_module` - https://github.com/apache/couchdb/commit/0fefc859eb9c18120064317da61a30adaeac5f92#diff-d9e3e3c91d4866fe966666619bda7991 - `callback_module` was added - https://github.com/apache/couchdb/commit/cf65280466499d652cff1171a2039af49c5677e8#diff-d9e3e3c91d4866fe966666619bda7991 - data provider specification can include options - https://github.com/apache/couchdb/blob/master/src/couch_epi/src/couch_epi_plugin.erl#L143
-rw-r--r--src/couch_epi/src/couch_epi.erl6
-rw-r--r--src/couch_epi/src/couch_epi_plugin.erl5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/couch_epi/src/couch_epi.erl b/src/couch_epi/src/couch_epi.erl
index a9132998b..2ce4592d2 100644
--- a/src/couch_epi/src/couch_epi.erl
+++ b/src/couch_epi/src/couch_epi.erl
@@ -58,8 +58,12 @@
-type apply_opts() :: [apply_opt()].
+-type data_spec_opt()
+ :: {interval, pos_integer()}.
+
-type data_spec()
- :: {module, module()}
+ :: {static_module, module()}
+ | {callback_module, module()}
| {priv_file, FileName :: string()}
| {file, FileName :: string()}.
diff --git a/src/couch_epi/src/couch_epi_plugin.erl b/src/couch_epi/src/couch_epi_plugin.erl
index 133a0d216..2cb1f3ebe 100644
--- a/src/couch_epi/src/couch_epi_plugin.erl
+++ b/src/couch_epi/src/couch_epi_plugin.erl
@@ -43,7 +43,10 @@
-callback providers() -> [{couch_epi:service_id(), module()}].
-callback services() -> [{couch_epi:service_id(), module()}].
-callback data_subscriptions() -> [{couch_epi:service_id(), couch_epi:key()}].
--callback data_providers() -> [{couch_epi:service_id(), couch_epi:data_spec()}].
+-callback data_providers() -> [
+ {couch_epi:key(), couch_epi:data_spec()}
+ | {couch_epi:key(), couch_epi:data_spec(), [couch_epi:data_spec_opt()]}
+].
-callback processes() -> [{couch_epi:plugin_id(), [supervisor:child_spec()]}].
-callback notify(Key :: term(), Old :: term(), New :: term()) -> ok.