Add couch_db_header:latest/1 This function returns false if it's supplied an integer less than the ?LATEST_DISK_VERSION, true if supplied ?LATEST_DISK_VERSION, and undefined on any other input.
BugzID: 15762 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/5a2da109 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/5a2da109 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/5a2da109 Branch: refs/heads/windsor-merge Commit: 5a2da109272d26767cea9bc695b6e34161d6f783 Parents: 50b5aab Author: Adam Kocoloski <[email protected]> Authored: Thu Jun 26 16:48:46 2014 -0400 Committer: Robert Newson <[email protected]> Committed: Tue Aug 26 10:42:38 2014 +0100 ---------------------------------------------------------------------- src/couch_db_header.erl | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5a2da109/src/couch_db_header.erl ---------------------------------------------------------------------- diff --git a/src/couch_db_header.erl b/src/couch_db_header.erl index 03f95ea..2d48434 100644 --- a/src/couch_db_header.erl +++ b/src/couch_db_header.erl @@ -26,6 +26,7 @@ update_seq/1, id_tree_state/1, seq_tree_state/1, + latest/1, local_tree_state/1, purge_seq/1, purged_docs/1, @@ -283,6 +284,12 @@ upgrade_compacted_seq(#db_header{}=Header) -> Header end. +latest(?LATEST_DISK_VERSION) -> + true; +latest(N) when is_integer(N), N < ?LATEST_DISK_VERSION -> + false; +latest(_Else) -> + undefined. -ifdef(TEST). -include_lib("eunit/include/eunit.hrl").
