couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [3/8] ddoc-cache commit: updated refs/heads/windsor-merge to 64bab93
Date Fri, 01 Aug 2014 09:09:28 GMT
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/windsor-merge
Commit: 72f6af5329f115a18b290b8b0c7031f0ad82520c
Parents: 6219808
Author: Brian Mitchell <brian@cloudant.com>
Authored: Thu Oct 10 16:50:38 2013 -0400
Committer: Robert Newson <rnewson@apache.org>
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).


Mime
View raw message