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 2018/03/09 11:41:45 UTC
[couchdb] branch master updated: Fix dialyzer warning for
couch_att:from_disk_term
This is an automated email from the ASF dual-hosted git repository.
jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/master by this push:
new 3c26bc3 Fix dialyzer warning for couch_att:from_disk_term
3c26bc3 is described below
commit 3c26bc301a2793b83205a197ef16bf449fbc4f9e
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Thu Mar 1 13:19:52 2018 -0800
Fix dialyzer warning for couch_att:from_disk_term
The `couch_att:from_disk_term` function is responible for conversion of
a disk format to #att{} record. However the way it is called
produces a dialyzer complaint.
Because `couch_att:from_disk_term` is always called as
`[couch_att:from_disk_term(Db, T) || T <- Doc1#doc.atts]`.
The `atts` field of `#doc{}` record is defined as
`[couch_att:att()] | binary()`
This is problematic because `att()` definition doesn't include disk
format representation. This commit adds disk format to the spec.
---
src/couch/src/couch_att.erl | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/couch/src/couch_att.erl b/src/couch/src/couch_att.erl
index d699b6a..16edd66 100644
--- a/src/couch/src/couch_att.erl
+++ b/src/couch/src/couch_att.erl
@@ -152,9 +152,31 @@
data_prop() | encoding_prop()
].
+-type disk_att_v1() :: {
+ Name :: binary(),
+ Type :: binary(),
+ Sp :: any(),
+ AttLen :: non_neg_integer(),
+ RevPos :: non_neg_integer(),
+ Md5 :: binary()
+}.
+
+-type disk_att_v2() :: {
+ Name :: binary(),
+ Type :: binary(),
+ Sp :: any(),
+ AttLen :: non_neg_integer(),
+ DiskLen :: non_neg_integer(),
+ RevPos :: non_neg_integer(),
+ Md5 :: binary(),
+ Enc :: identity | gzip
+}.
+
+-type disk_att_v3() :: {Base :: tuple(), Extended :: list()}.
--type att() :: #att{} | attachment().
+-type disk_att() :: disk_att_v1() | disk_att_v2() | disk_att_v3().
+-type att() :: #att{} | attachment() | disk_att().
new() ->
%% We construct a record by default for compatability. This will be
--
To stop receiving notification emails like this one, please contact
jan@apache.org.