couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [couchdb] 05/13: Rename handle_call and handle_info callbacks
Date Tue, 30 May 2017 18:43:12 GMT
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 fe02bcc8222e9559af5d70e38f0c11b87bd8d95d
Author: Paul J. Davis <paul.joseph.davis@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 068d3c9..a5318cd 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,
@@ -162,11 +162,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 d788912..7271f3a 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()}.
@@ -573,8 +573,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,
@@ -647,11 +647,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} ->
@@ -659,12 +659,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 dd5b4e7..ddf15a2 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -166,7 +166,7 @@ handle_call({purge_docs, IdRevs}, _From, Db) ->
     {reply, {ok, PurgeSeq, PurgedIdRevs}, Db2};
 
 handle_call(Msg, From, Db) ->
-    couch_db_engine:handle_call(Msg, From, Db).
+    couch_db_engine:handle_db_updater_call(Msg, From, Db).
 
 
 handle_cast({load_validation_funs, ValidationFuns}, Db) ->
@@ -267,7 +267,7 @@ handle_info({'EXIT', _Pid, normal}, Db) ->
 handle_info({'EXIT', _Pid, Reason}, Db) ->
     {stop, Reason, Db};
 handle_info(Msg, Db) ->
-    couch_db_engine:handle_info(Msg, Db).
+    couch_db_engine:handle_db_updater_info(Msg, Db).
 
 code_change(_OldVsn, State, _Extra) ->
     {ok, State}.

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

Mime
View raw message