diff options
-rw-r--r-- | src/dreyfus/src/clouseau_rpc.erl | 9 | ||||
-rw-r--r-- | src/mango/src/mango_idx.erl | 8 | ||||
-rw-r--r-- | src/mango/src/mango_native_proc.erl | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/dreyfus/src/clouseau_rpc.erl b/src/dreyfus/src/clouseau_rpc.erl index aed03e37f..38d6142d6 100644 --- a/src/dreyfus/src/clouseau_rpc.erl +++ b/src/dreyfus/src/clouseau_rpc.erl @@ -23,6 +23,7 @@ -export([delete/2, update/3, cleanup/1, cleanup/2, rename/1]). -export([analyze/2, version/0, disk_size/1]). -export([set_purge_seq/2, get_purge_seq/1, get_root_dir/0]). +-export([connected/0]). open_index(Peer, Path, Analyzer) -> rpc({main, clouseau()}, {open, Peer, Path, Analyzer}). @@ -91,6 +92,14 @@ analyze(Analyzer, Text) -> version() -> rpc({main, clouseau()}, version). +connected() -> + case version() of + {'EXIT', noconnection} -> + false; + _ -> + true + end. + rpc(Ref, Msg) -> ioq:call(Ref, Msg, erlang:get(io_priority)). diff --git a/src/mango/src/mango_idx.erl b/src/mango/src/mango_idx.erl index c2c26958c..5d06a8fe3 100644 --- a/src/mango/src/mango_idx.erl +++ b/src/mango/src/mango_idx.erl @@ -182,7 +182,7 @@ from_ddoc(Db, {Props}) -> _ -> ?MANGO_ERROR(invalid_query_ddoc_language) end, - IdxMods = case module_loaded(dreyfus_index) of + IdxMods = case clouseau_rpc:connected() of true -> [mango_idx_view, mango_idx_text]; false -> @@ -268,7 +268,7 @@ cursor_mod(#idx{type = <<"json">>}) -> cursor_mod(#idx{def = all_docs, type= <<"special">>}) -> mango_cursor_special; cursor_mod(#idx{type = <<"text">>}) -> - case module_loaded(dreyfus_index) of + case clouseau_rpc:connected() of true -> mango_cursor_text; false -> @@ -281,7 +281,7 @@ idx_mod(#idx{type = <<"json">>}) -> idx_mod(#idx{type = <<"special">>}) -> mango_idx_special; idx_mod(#idx{type = <<"text">>}) -> - case module_loaded(dreyfus_index) of + case clouseau_rpc:connected() of true -> mango_idx_text; false -> @@ -309,7 +309,7 @@ get_idx_def(Opts) -> get_idx_type(Opts) -> case proplists:get_value(type, Opts) of <<"json">> -> <<"json">>; - <<"text">> -> case module_loaded(dreyfus_index) of + <<"text">> -> case clouseau_rpc:connected() of true -> <<"text">>; false -> diff --git a/src/mango/src/mango_native_proc.erl b/src/mango/src/mango_native_proc.erl index ab161469a..274ae11de 100644 --- a/src/mango/src/mango_native_proc.erl +++ b/src/mango/src/mango_native_proc.erl @@ -345,7 +345,7 @@ make_text_field_name([P | Rest], Type) -> validate_index_info(IndexInfo) -> - IdxTypes = case module_loaded(dreyfus_index) of + IdxTypes = case clouseau_rpc:connected() of true -> [mango_idx_view, mango_idx_text]; false -> |