Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7B84411BDE for ; Thu, 28 Aug 2014 12:17:44 +0000 (UTC) Received: (qmail 24219 invoked by uid 500); 28 Aug 2014 12:17:44 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 23847 invoked by uid 500); 28 Aug 2014 12:17:44 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 23779 invoked by uid 99); 28 Aug 2014 12:17:44 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Aug 2014 12:17:44 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C41C5A02CFB; Thu, 28 Aug 2014 12:17:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rnewson@apache.org To: commits@couchdb.apache.org Date: Thu, 28 Aug 2014 12:17:45 -0000 Message-Id: <9d4ce725388941c0b078d5772e58b3a2@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [03/10] ddoc-cache commit: updated refs/heads/master to 4ffc6b0 Add a simple dialyzer task This fixes a number of dialyzer warnings as well. Mostly for simple missing matches. I'm not sure it's worth covering all of these cases just yet but it wasn't hard for this code. I've also included the ets_lru module in the dialyzer source to help ensure that the new match APIs are used correctly. It will skip it if it's not found on the default path or at ETS_LRU_PATH. Project: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/commit/72f6af53 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/tree/72f6af53 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/diff/72f6af53 Branch: refs/heads/master Commit: 72f6af5329f115a18b290b8b0c7031f0ad82520c Parents: 6219808 Author: Brian Mitchell Authored: Thu Oct 10 16:50:38 2013 -0400 Committer: Robert Newson Committed: Tue Jul 29 11:50:34 2014 +0100 ---------------------------------------------------------------------- src/ddoc_cache_opener.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/blob/72f6af53/src/ddoc_cache_opener.erl ---------------------------------------------------------------------- diff --git a/src/ddoc_cache_opener.erl b/src/ddoc_cache_opener.erl index 56bfa7d..e949f60 100644 --- a/src/ddoc_cache_opener.erl +++ b/src/ddoc_cache_opener.erl @@ -43,6 +43,9 @@ -define(OPENING, ddoc_cache_opening). +-type dbname() :: iodata(). +-type docid() :: iodata(). +-type revision() :: {integer(), binary()}. -record(opener, { key, @@ -62,7 +65,7 @@ start_link() -> init(_) -> process_flag(trap_exit, true), - ets:new(?OPENING, [set, protected, named_table, {keypos, #opener.key}]), + _ = ets:new(?OPENING, [set, protected, named_table, {keypos, #opener.key}]), {ok, Evictor} = couch_event:link_listener( ?MODULE, handle_db_event, nil, [all_dbs] ), @@ -144,7 +147,7 @@ handle_info({'EXIT', Pid, Reason}, St) -> Pattern = #opener{pid=Pid, _='_'}, case ets:match_object(?OPENING, Pattern) of [#opener{key=Key, clients=Clients}] -> - [gen_server:reply(C, {error, Reason}) || C <- Clients], + _ = [gen_server:reply(C, {error, Reason}) || C <- Clients], ets:delete(?OPENING, Key), {noreply, St}; [] -> @@ -169,6 +172,7 @@ handle_db_event(_DbName, _Event, St) -> {ok, St}. +-spec open_ddoc({dbname(), validation_funs | docid()}) -> no_return(). open_ddoc({DbName, validation_funs}=Key) -> {ok, DDocs} = fabric:design_docs(mem3:dbname(DbName)), Funs = lists:flatmap(fun(DDoc) -> @@ -194,5 +198,5 @@ open_ddoc({DbName, DDocId}=Key) -> respond(Key, Resp) -> [#opener{clients=Clients}] = ets:lookup(?OPENING, Key), - [gen_server:reply(C, Resp) || C <- Clients], + _ = [gen_server:reply(C, Resp) || C <- Clients], ets:delete(?OPENING, Key).