diff options
author | benoitc <bchesneau@gmail.com> | 2011-09-10 11:19:20 +0200 |
---|---|---|
committer | benoitc <bchesneau@gmail.com> | 2011-09-12 23:13:14 +0200 |
commit | 7d8a8d69048955e97b6abe6118d28fda70fec271 (patch) | |
tree | 59dcbec839255814dca38c637d27a1f88204e6a2 /apps/couch | |
parent | 2529e3cd98c2380aebf30a985539f5f3f4e09133 (diff) |
Add missing database 'created' event.
The `created` event is emitted on apache couchdb when a database is
created. This patch re-add it to bigcouch.
Diffstat (limited to 'apps/couch')
-rw-r--r-- | apps/couch/src/couch_server.erl | 12 |
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], |