You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2020/10/24 06:53:04 UTC
[couchdb] 01/02: Fix dialyzer warnings
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch handle-insert-conflict
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 59d799c37d609863a80f564bb70f874ed5a2472b
Author: Jay Doane <ja...@apache.org>
AuthorDate: Fri Oct 23 23:36:52 2020 -0700
Fix dialyzer warnings
Fix specs to eliminate dialyzer warnings.
---
src/couch_expiring_cache/.suppressed | 1 +
src/couch_expiring_cache/src/couch_expiring_cache.erl | 5 +++--
src/couch_expiring_cache/src/couch_expiring_cache_fdb.erl | 6 +++---
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/couch_expiring_cache/.suppressed b/src/couch_expiring_cache/.suppressed
new file mode 100644
index 0000000..3baad65
--- /dev/null
+++ b/src/couch_expiring_cache/.suppressed
@@ -0,0 +1 @@
+no_return
diff --git a/src/couch_expiring_cache/src/couch_expiring_cache.erl b/src/couch_expiring_cache/src/couch_expiring_cache.erl
index b26556e..f1ce202 100644
--- a/src/couch_expiring_cache/src/couch_expiring_cache.erl
+++ b/src/couch_expiring_cache/src/couch_expiring_cache.erl
@@ -31,8 +31,9 @@ insert(Name, Key, Value, StaleTS, ExpiresTS)
insert(undefined, Name, Key, Value, StaleTS, ExpiresTS).
--spec insert(Tx :: jtx(), Name :: binary(), Key :: binary(), Value :: binary(),
- StaleTS :: ?TIME_UNIT(), ExpiresTS :: ?TIME_UNIT()) -> ok.
+-spec insert(Tx :: jtx() | undefined, Name :: binary(), Key :: binary(),
+ Value :: binary(), StaleTS :: ?TIME_UNIT(), ExpiresTS :: ?TIME_UNIT()) -> ok.
+-dialyzer({no_return, insert/6}).
insert(Tx, Name, Key, Value, StaleTS, ExpiresTS)
when is_binary(Name), is_binary(Key), is_binary(Value),
is_integer(StaleTS), is_integer(ExpiresTS) ->
diff --git a/src/couch_expiring_cache/src/couch_expiring_cache_fdb.erl b/src/couch_expiring_cache/src/couch_expiring_cache_fdb.erl
index 7c4ad8f..3f6e1aa 100644
--- a/src/couch_expiring_cache/src/couch_expiring_cache_fdb.erl
+++ b/src/couch_expiring_cache/src/couch_expiring_cache_fdb.erl
@@ -37,7 +37,7 @@
-spec insert(JTx :: jtx(), Name :: binary(), Key :: binary(), Value :: binary(),
- StaleTS :: ?TIME_UNIT, ExpiresTS :: ?TIME_UNIT) -> ok.
+ StaleTS :: millisecond(), ExpiresTS :: millisecond()) -> ok.
insert(#{jtx := true} = JTx, Name, Key, Val, StaleTS, ExpiresTS) ->
#{tx := Tx, layer_prefix := LayerPrefix} = couch_jobs_fdb:get_jtx(JTx),
PK = primary_key(Name, Key, LayerPrefix),
@@ -86,7 +86,7 @@ clear_all(Name) ->
end).
--spec clear_range_to(Name :: binary(), EndTS :: ?TIME_UNIT,
+-spec clear_range_to(Name :: binary(), EndTS :: millisecond(),
Limit :: non_neg_integer()) ->
OldestTS :: ?TIME_UNIT.
clear_range_to(Name, EndTS, Limit) when Limit > 0 ->
@@ -98,7 +98,7 @@ clear_range_to(Name, EndTS, Limit) when Limit > 0 ->
end, 0).
--spec get_range_to(Name :: binary(), EndTS :: ?TIME_UNIT,
+-spec get_range_to(Name :: binary(), EndTS :: millisecond(),
Limit :: non_neg_integer()) ->
[{Key :: binary(), Val :: binary()}].
get_range_to(Name, EndTS, Limit) when Limit > 0 ->