You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/10/15 18:45:52 UTC

couch commit: updated refs/heads/master to b5e7e54

Repository: couchdb-couch
Updated Branches:
  refs/heads/master 92598cd33 -> b5e7e54fa


Add IS_OLD_RECORD macro

This can be used in guards to detect if a state variable needs to be
upgraded. An example of it's use might be:

    handle_call(Msg, From, St) when ?IS_OLD_RECORD(St, #st{}) ->
        handle_call(Msg, From, upgrade_state(St));

This is useful for upgrading any of our various gen behaviors that
aren't properly supervised.

This closes #23

COUCHDB-2511

Signed-off-by: Alexander Shorin <kx...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/b5e7e54f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/b5e7e54f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/b5e7e54f

Branch: refs/heads/master
Commit: b5e7e54faba5bc06ebd76cd64b0dd5e2c1d06f0c
Parents: 92598cd
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Dec 12 14:25:38 2014 -0600
Committer: Alexander Shorin <kx...@apache.org>
Committed: Thu Oct 15 19:43:46 2015 +0300

----------------------------------------------------------------------
 include/couch_db.hrl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/b5e7e54f/include/couch_db.hrl
----------------------------------------------------------------------
diff --git a/include/couch_db.hrl b/include/couch_db.hrl
index a7a1fdb..e7cd85d 100644
--- a/include/couch_db.hrl
+++ b/include/couch_db.hrl
@@ -23,6 +23,8 @@
 -define(JSON_ENCODE(V), couch_util:json_encode(V)).
 -define(JSON_DECODE(V), couch_util:json_decode(V)).
 
+-define(IS_OLD_RECORD(V, R), (tuple_size(V) /= tuple_size(R))).
+
 -define(b2l(V), binary_to_list(V)).
 -define(l2b(V), list_to_binary(V)).
 -define(i2b(V), couch_util:integer_to_boolean(V)).