summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_view.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/couchdb/couch_view.erl')
-rw-r--r--src/couchdb/couch_view.erl20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl
index fc304dee..ec6b16cf 100644
--- a/src/couchdb/couch_view.erl
+++ b/src/couchdb/couch_view.erl
@@ -13,7 +13,7 @@
-module(couch_view).
-behaviour(gen_server).
--export([start_link/1,fold/4,fold/5,less_json/2, start_update_loop/3, start_temp_update_loop/5]).
+-export([start_link/0,fold/4,fold/5,less_json/2, start_update_loop/3, start_temp_update_loop/5]).
-export([init/1,terminate/2,handle_call/3,handle_cast/2,handle_info/2,code_change/3]).
-export([get_reduce_view/1, get_map_view/1,get_row_count/1,reduce_to_count/1, fold_reduce/7]).
@@ -43,10 +43,8 @@
{root_dir
}).
-start_link(RootDir) ->
- gen_server:start_link({local, couch_view}, couch_view, RootDir, []).
-
-
+start_link() ->
+ gen_server:start_link({local, couch_view}, couch_view, [], []).
get_temp_updater(DbName, Type, MapSrc, RedSrc) ->
{ok, Pid} = gen_server:call(couch_view, {start_temp_updater, DbName, Type, MapSrc, RedSrc}),
@@ -222,7 +220,15 @@ fold(#view{btree=Btree}, StartKey, Dir, Fun, Acc) ->
{ok, _AccResult} = couch_btree:fold(Btree, StartKey, Dir, WrapperFun, Acc).
-init(RootDir) ->
+init([]) ->
+ % read configuration settings and register for configuration changes
+ RootDir = couch_config:get({"CouchDB", "RootDirectory"}),
+ Self = self(),
+ ok = couch_config:register(
+ fun({"CouchDB", "RootDirectory"})->
+ exit(Self, config_change)
+ end),
+
couch_db_update_notifier:start_link(
fun({deleted, DbName}) ->
gen_server:cast(couch_view, {reset_indexes, DbName});
@@ -238,7 +244,7 @@ init(RootDir) ->
process_flag(trap_exit, true),
{ok, #server{root_dir=RootDir}}.
-terminate(_Reason, _) ->
+terminate(_Reason,_State) ->
ok.