summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Doane <jay.s.doane@gmail.com>2017-04-05 11:09:43 -0700
committerJay Doane <jay.s.doane@gmail.com>2017-04-19 11:33:54 -0700
commit81166c51ef747e78287df4e1c7e85f10d7d157f4 (patch)
tree1ed05471f134dfac99c9ab60a4bdbeba7f4b109f
parent1c945229948a9257f98443784f2d2f2a2a556ac1 (diff)
downloadcouchdb-81166c51ef747e78287df4e1c7e85f10d7d157f4.tar.gz
Expose couch_index_compactor:get_compacting_pid/1
Useful for debugging and testing
-rw-r--r--src/couch_index/src/couch_index_compactor.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/couch_index/src/couch_index_compactor.erl b/src/couch_index/src/couch_index_compactor.erl
index 106a02b33..61f406c1a 100644
--- a/src/couch_index/src/couch_index_compactor.erl
+++ b/src/couch_index/src/couch_index_compactor.erl
@@ -15,7 +15,7 @@
%% API
--export([start_link/2, run/2, cancel/1, is_running/1]).
+-export([start_link/2, run/2, cancel/1, is_running/1, get_compacting_pid/1]).
%% gen_server callbacks
-export([init/1, terminate/2, code_change/3]).
@@ -47,6 +47,8 @@ cancel(Pid) ->
is_running(Pid) ->
gen_server:call(Pid, is_running).
+get_compacting_pid(Pid) ->
+ gen_server:call(Pid, get_compacting_pid).
init({Index, Module}) ->
process_flag(trap_exit, true),
@@ -69,6 +71,8 @@ handle_call(cancel, _From, #st{pid=Pid}=State) ->
unlink(Pid),
exit(Pid, kill),
{reply, ok, State#st{pid=undefined}};
+handle_call(get_compacting_pid, _From, #st{pid=Pid}=State) ->
+ {reply, {ok, Pid}, State};
handle_call(is_running, _From, #st{pid=Pid}=State) when is_pid(Pid) ->
{reply, true, State};
handle_call(is_running, _From, State) ->