You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/09/12 20:08:54 UTC

[couchdb] 11/28: Rename handle_call and handle_info callbacks

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 65dfabb4706e88d1d3cac2f37c9aed4cdae84314
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Tue May 30 11:27:08 2017 -0500

    Rename handle_call and handle_info callbacks
    
    This is to avoid clashing with the gen behavior callbacks in case
    someone ever decides to mix couch_db_engine and gen behaviors in a
    single module.
---
 src/couch/src/couch_bt_engine.erl  |  8 ++++----
 src/couch/src/couch_db_engine.erl  | 16 ++++++++--------
 src/couch/src/couch_db_updater.erl |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index 90c321c..af13f7a 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -21,8 +21,8 @@
 
     init/2,
     terminate/2,
-    handle_call/2,
-    handle_info/2,
+    handle_db_updater_call/2,
+    handle_db_updater_info/2,
 
     incref/1,
     decref/1,
@@ -164,11 +164,11 @@ terminate(_Reason, St) ->
     ok.
 
 
-handle_call(Msg, St) ->
+handle_db_updater_call(Msg, St) ->
     {stop, {invalid_call, Msg}, {invalid_call, Msg}, St}.
 
 
-handle_info({'DOWN', Ref, _, _, _}, #st{fd_monitor=Ref} = St) ->
+handle_db_updater_info({'DOWN', Ref, _, _, _}, #st{fd_monitor=Ref} = St) ->
     {stop, normal, St#st{fd=undefined, fd_monitor=closed}}.
 
 
diff --git a/src/couch/src/couch_db_engine.erl b/src/couch/src/couch_db_engine.erl
index bc09172..7821368 100644
--- a/src/couch/src/couch_db_engine.erl
+++ b/src/couch/src/couch_db_engine.erl
@@ -140,14 +140,14 @@
 % This is called in the context of couch_db_updater:handle_call/3
 % for any message that is unknown. It can be used to handle messages
 % from asynchronous processes like the engine's compactor if it has one.
--callback handle_call(Msg::any(), DbHandle::db_handle()) ->
+-callback handle_db_updater_call(Msg::any(), DbHandle::db_handle()) ->
         {reply, Resp::any(), NewDbHandle::db_handle()} |
         {stop, Reason::any(), Resp::any(), NewDbHandle::db_handle()}.
 
 
 % This is called in the context of couch_db_updater:handle_info/2
 % and has the same properties as handle_call/3.
--callback handle_info(Msg::any(), DbHandle::db_handle()) ->
+-callback handle_db_updater_info(Msg::any(), DbHandle::db_handle()) ->
     {noreply, NewDbHandle::db_handle()} |
     {noreply, NewDbHandle::db_handle(), Timeout::timeout()} |
     {stop, Reason::any(), NewDbHandle::db_handle()}.
@@ -582,8 +582,8 @@
 
     init/3,
     terminate/2,
-    handle_call/3,
-    handle_info/2,
+    handle_db_updater_call/3,
+    handle_db_updater_info/2,
 
     incref/1,
     decref/1,
@@ -658,11 +658,11 @@ terminate(Reason, #db{} = Db) ->
     Engine:terminate(Reason, EngineState).
 
 
-handle_call(Msg, _From, #db{} = Db) ->
+handle_db_updater_call(Msg, _From, #db{} = Db) ->
     #db{
         engine = {Engine, EngineState}
     } = Db,
-    case Engine:handle_call(Msg, EngineState) of
+    case Engine:handle_db_updater_call(Msg, EngineState) of
         {reply, Resp, NewState} ->
             {reply, Resp, Db#db{engine = {Engine, NewState}}};
         {stop, Reason, Resp, NewState} ->
@@ -670,12 +670,12 @@ handle_call(Msg, _From, #db{} = Db) ->
     end.
 
 
-handle_info(Msg, #db{} = Db) ->
+handle_db_updater_info(Msg, #db{} = Db) ->
     #db{
         name = Name,
         engine = {Engine, EngineState}
     } = Db,
-    case Engine:handle_info(Msg, EngineState) of
+    case Engine:handle_db_updater_info(Msg, EngineState) of
         {noreply, NewState} ->
             {noreply, Db#db{engine = {Engine, NewState}}};
         {noreply, NewState, Timeout} ->
diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 3f9b8f7..d7a9af6 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -168,7 +168,7 @@ handle_call({purge_docs, IdRevs}, _From, Db) ->
     {reply, {ok, PurgeSeq, PurgedIdRevs}, Db2, idle_limit()};
 
 handle_call(Msg, From, Db) ->
-    case couch_db_engine:handle_call(Msg, From, Db) of
+    case couch_db_engine:handle_db_updater_call(Msg, From, Db) of
         {reply, Resp, NewDb} ->
             {reply, Resp, NewDb, idle_limit()};
         Else ->
@@ -298,7 +298,7 @@ handle_info(timeout, #db{fd=Fd, name=DbName} = Db) ->
     {noreply, Db, hibernate};
 
 handle_info(Msg, Db) ->
-    case couch_db_engine:handle_info(Msg, Db) of
+    case couch_db_engine:handle_db_updater_info(Msg, Db) of
         {noreply, NewDb} ->
             {noreply, NewDb, idle_limit()};
         Else ->

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.