summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2011-09-12 14:56:38 -0700
committerAdam Kocoloski <adam@cloudant.com>2011-09-12 14:56:38 -0700
commit8a96880cd02ea9286dea597d213ddf0d4487cbc3 (patch)
tree59dcbec839255814dca38c637d27a1f88204e6a2
parent2529e3cd98c2380aebf30a985539f5f3f4e09133 (diff)
parent7d8a8d69048955e97b6abe6118d28fda70fec271 (diff)
Merge pull request #62 from benoitc/master
-rw-r--r--apps/couch/src/couch_server.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/couch/src/couch_server.erl b/apps/couch/src/couch_server.erl
index cfe0b5fc..f9c960c5 100644
--- a/apps/couch/src/couch_server.erl
+++ b/apps/couch/src/couch_server.erl
@@ -217,7 +217,7 @@ open_async(Server, From, DbName, Filepath, Options) ->
Parent = self(),
Opener = spawn_link(fun() ->
Res = couch_db:start_link(DbName, Filepath, Options),
- gen_server:call(Parent, {open_result, DbName, Res}, infinity),
+ gen_server:call(Parent, {open_result, DbName, Res, Options}, infinity),
unlink(Parent)
end),
% icky hack of field values - compactor_pid used to store clients
@@ -244,15 +244,21 @@ handle_call({set_max_dbs_open, Max}, _From, Server) ->
{reply, ok, Server#server{max_dbs_open=Max}};
handle_call(get_server, _From, Server) ->
{reply, {ok, Server}, Server};
-handle_call({open_result, DbName, {ok, Db}}, _From, Server) ->
+handle_call({open_result, DbName, {ok, Db}, Options}, _From, Server) ->
link(Db#db.main_pid),
% icky hack of field values - compactor_pid used to store clients
[#db{compactor_pid=Froms}] = ets:lookup(couch_dbs, DbName),
[gen_server:reply(From, {ok, Db}) || From <- Froms],
true = ets:insert(couch_dbs, Db),
true = ets:insert(couch_lru, {DbName, now()}),
+ case lists:member(create, Options) of
+ true ->
+ couch_db_update_notifier:notify({created, DbName});
+ false ->
+ ok
+ end,
{reply, ok, Server};
-handle_call({open_result, DbName, Error}, _From, Server) ->
+handle_call({open_result, DbName, Error, _Options}, _From, Server) ->
% icky hack of field values - compactor_pid used to store clients
[#db{compactor_pid=Froms}] = ets:lookup(couch_dbs, DbName),
[gen_server:reply(From, Error) || From <- Froms],