From c1f2441020fcba500821981013144aff1fd8f8b9 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 13 Sep 2009 11:14:59 +0000 Subject: allow config callbacks to get passed the X-Couch-Persist flag git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@814300 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_config.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/couchdb/couch_config.erl') diff --git a/src/couchdb/couch_config.erl b/src/couchdb/couch_config.erl index 69d0ac93..5d911455 100644 --- a/src/couchdb/couch_config.erl +++ b/src/couchdb/couch_config.erl @@ -128,7 +128,7 @@ handle_call({set, Sec, Key, Val, Persist}, _From, Config) -> _ -> ok end, - [catch F(Sec, Key, Val) || {_Pid, F} <- Config#config.notify_funs], + [catch F(Sec, Key, Val, Persist) || {_Pid, F} <- Config#config.notify_funs], {reply, ok, Config}; handle_call({delete, Sec, Key, Persist}, _From, Config) -> true = ets:delete(?MODULE, {Sec,Key}), @@ -140,7 +140,7 @@ handle_call({delete, Sec, Key, Persist}, _From, Config) -> _ -> ok end, - [catch F(Sec, Key, deleted) || {_Pid, F} <- Config#config.notify_funs], + [catch F(Sec, Key, deleted, Persist) || {_Pid, F} <- Config#config.notify_funs], {reply, ok, Config}; handle_call({register, Fun, Pid}, _From, #config{notify_funs=PidFuns}=Config) -> erlang:monitor(process, Pid), @@ -148,10 +148,12 @@ handle_call({register, Fun, Pid}, _From, #config{notify_funs=PidFuns}=Config) -> Fun2 = case Fun of _ when is_function(Fun, 1) -> - fun(Section, _Key, _Value) -> Fun(Section) end; + fun(Section, _Key, _Value, _Persist) -> Fun(Section) end; _ when is_function(Fun, 2) -> - fun(Section, Key, _Value) -> Fun(Section, Key) end; + fun(Section, Key, _Value, _Persist) -> Fun(Section, Key) end; _ when is_function(Fun, 3) -> + fun(Section, Key, Value, _Persist) -> Fun(Section, Key, Value) end; + _ when is_function(Fun, 4) -> Fun end, {reply, ok, Config#config{notify_funs=[{Pid, Fun2} | PidFuns]}}. -- cgit v1.2.3