diff options
author | Jan Lehnardt <jan@apache.org> | 2008-08-20 13:55:41 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2008-08-20 13:55:41 +0000 |
commit | 2bc4be3dbf9e8ea3b67c62f2d99087ff4b43c17b (patch) | |
tree | 9a961f6f3fb0acbd9d34abef40492bbe95cc3d94 /src/couchdb/couch_view.erl | |
parent | ad6fd47a1f13e8d09eb5864c50e102825e28b75c (diff) |
Merge runtimeconfig branch back into trunk
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@687336 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_view.erl')
-rw-r--r-- | src/couchdb/couch_view.erl | 20 |
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. |