tonysun83 commented on a change in pull request #1432: Support callback module 
data provider
URL: https://github.com/apache/couchdb/pull/1432#discussion_r201907567
 
 

 ##########
 File path: src/couch_epi/src/couch_epi_data.erl
 ##########
 @@ -102,12 +102,15 @@ definitions({file, FilePath}) ->
         {error, Reason} ->
             {error, {FilePath, Reason}}
     end;
-definitions({module, Module}) when is_atom(Module) ->
-    definitions({module, [Module]});
-definitions({module, Modules}) ->
+definitions({static_module, Module}) when is_atom(Module) ->
+    definitions({static_module, [Module]});
+definitions({static_module, Modules}) ->
     Data = lists:append([M:data() || M <- Modules]),
     Hash = couch_epi_functions_gen:hash(Modules),
-    {ok, Hash, Data}.
+    {ok, Hash, Data};
+definitions({callback_module, Module}) ->
+    Data = Module:data(),
 
 Review comment:
   Upon reviewing the rest of the code base, I don't see 
```couch_epi_data_gen:generate/3``` being called anywhere in codebase. Perhaps 
I'm misunderstanding how the process should work. My understanding is
   
   1) I call ```couch_epi_data_gen:generate/3``` in my code to generate a new 
data module.
   2) ```data/0``` is constantly being called every interval to check for new 
values. 
   ```
   data() ->
       config:get("dreyfus").
   ```
   3) If ```config:set("dreyfus", "foo", "bar").``` is called, then 
   ```
   data() ->
      config:get("dreyfus", "foo").
   ```
   will return a "bar" which is a new value. This should trigger some mechanism 
to call ```couch_epi_data_gen:generate/3``` to regenerate the module. This last 
piece
   I am confused as to when and where this should occur.  Perhaps something 
needs to be done in the ```notify/3``` function?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to