jiangphcn commented on a change in pull request #1187: [WIP] Couchdb 3326 
clustered purge
URL: https://github.com/apache/couchdb/pull/1187#discussion_r174006817
 
 

 ##########
 File path: src/couch_index/src/couch_index_plugin_couch_db.erl
 ##########
 @@ -0,0 +1,42 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_index_plugin_couch_db).
+
+-export([
+    before_copy_purge_info/1
+]).
+
+-include_lib("couch/include/couch_db.hrl").
+-include_lib("couch_mrview/include/couch_mrview.hrl").
+
+
+before_copy_purge_info(DbName) ->
+    {ok, DDocs} = design_docs(DbName),
+    lists:map(fun(DDoc) ->
+        JsonDDoc = couch_doc:from_json_obj(DDoc),
+        couch_mrview_index:maybe_create_local_purge_doc(DbName, JsonDDoc)
 
 Review comment:
   Yes, the plugin could live in any repo, even in a private one. The point is 
here related to design patten about couch_index and couch_mrview. They are 
bundled for mrview index. I ever try to add logic to couch_mrview_epi, 
couch_mrview_plugin and couch_mrview_plugin_couch_db. However, we still need to 
register couch_mrview_epi. Can't find right place in couch_mrview, but 
https://github.com/apache/couchdb/blob/master/src/couch_index/src/couch_index_sup.erl#L24

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to