You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/07 17:42:04 UTC

[1/2] couchdb commit: updated refs/heads/windsor-merge to 31c3b32

Repository: couchdb
Updated Branches:
  refs/heads/windsor-merge 5b1f7cea0 -> 31c3b32b6


Move attachment code into couch_att

This is moves a majority of the attachment representation
into the couch_att module. This serves to isolate the
current record to allow easier in-place upgrades as well as
a place to start collecting common attachment related
functionality.

The upgrades are handled lazily to allow rollbacks to older
code if the new attachment format has not yet been required
via storage of any of the new extended attributes supported
by the fetch/store APIs. There are some caveats to this in
that the extended attributes are not enforced by couch_att
at this time so it'd be quite easy to store garbage. As the
extent of attachment concerns becomes more stable, a set of
more permanent fetch_[field]/store_[field] functions may be
added to help enforce both field types as well as common
field names and defaults (all fields will default to
undefined except for those defaults present in the orignal
record definition, which carry over automatically).

Finally, while this patch does move a lot of code to
couch_att, it hasn't refined the interfaces much. These
changes will follow in later patches to improve and
simplify the organization of attachment code. This
includes the addition of more unit tests which currently
only cover some portions of the attachment functionality
related to upgrades and field fetching & storage.


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

Branch: refs/heads/windsor-merge
Commit: 91294eb3fa05da59ed93718a4be2f7fc1bfe9d6a
Parents: 5b1f7ce
Author: Brian Mitchell <br...@p2p.io>
Authored: Wed Dec 11 23:07:50 2013 -0500
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Aug 7 16:39:17 2014 +0100

----------------------------------------------------------------------
 test/etap/030-doc-from-json.t | 38 ++++++++++------------
 test/etap/031-doc-to-json.t   | 66 ++++++++++++++++++--------------------
 2 files changed, 48 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/91294eb3/test/etap/030-doc-from-json.t
----------------------------------------------------------------------
diff --git a/test/etap/030-doc-from-json.t b/test/etap/030-doc-from-json.t
index 79d5692..1a11d8d 100755
--- a/test/etap/030-doc-from-json.t
+++ b/test/etap/030-doc-from-json.t
@@ -14,11 +14,7 @@
 % License for the specific language governing permissions and limitations under
 % the License.
 
-%% XXX: Figure out how to -include("couch_db.hrl")
--record(doc, {id= <<"">>, revs={0, []}, body={[]},
-            atts=[], deleted=false, meta=[]}).
--record(att, {name, type, att_len, disk_len, md5= <<>>, revpos=0, data,
-            encoding=identity}).
+-include_lib("couch/include/couch_db.hrl").
 
 main(_) ->
     test_util:init_code_path(),
@@ -84,22 +80,22 @@ test_from_json_success() ->
                 ]}}
             ]}}]},
             #doc{atts=[
-                #att{
-                    name = <<"my_attachment.fu">>,
-                    data = stub,
-                    type = <<"application/awesome">>,
-                    att_len = 45,
-                    disk_len = 45,
-                    revpos = nil
-                },
-                #att{
-                    name = <<"noahs_private_key.gpg">>,
-                    data = <<"I have a pet fish!">>,
-                    type = <<"application/pgp-signature">>,
-                    att_len = 18,
-                    disk_len = 18,
-                    revpos = 0
-                }
+                couch_att:new([
+                    {name, <<"my_attachment.fu">>},
+                    {data, stub},
+                    {type, <<"application/awesome">>},
+                    {att_len, 45},
+                    {disk_len, 45},
+                    {revpos, undefined}
+                ]),
+                couch_att:new([
+                    {name, <<"noahs_private_key.gpg">>},
+                    {data, <<"I have a pet fish!">>},
+                    {type, <<"application/pgp-signature">>},
+                    {att_len, 18},
+                    {disk_len, 18},
+                    {revpos, 0}
+                ])
             ]},
             "Attachments are parsed correctly."
         },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/91294eb3/test/etap/031-doc-to-json.t
----------------------------------------------------------------------
diff --git a/test/etap/031-doc-to-json.t b/test/etap/031-doc-to-json.t
index e0aaf70..d4227e7 100755
--- a/test/etap/031-doc-to-json.t
+++ b/test/etap/031-doc-to-json.t
@@ -14,11 +14,7 @@
 % License for the specific language governing permissions and limitations under
 % the License.
 
-%% XXX: Figure out how to -include("couch_db.hrl")
--record(doc, {id= <<"">>, revs={0, []}, body={[]},
-            atts=[], deleted=false, meta=[]}).
--record(att, {name, type, att_len, disk_len, md5= <<>>, revpos=0, data,
-            encoding=identity}).
+-include_lib("couch/include/couch_db.hrl").
 
 main(_) ->
     test_util:init_code_path(),
@@ -114,22 +110,22 @@ test_to_json_success() ->
         },
         {
             #doc{atts=[
-                #att{
-                    name = <<"big.xml">>, 
-                    type = <<"xml/sucks">>, 
-                    data = fun() -> ok end,
-                    revpos = 1,
-                    att_len = 400,
-                    disk_len = 400
-                },
-                #att{
-                    name = <<"fast.json">>, 
-                    type = <<"json/ftw">>, 
-                    data = <<"{\"so\": \"there!\"}">>,
-                    revpos = 1,
-                    att_len = 16,
-                    disk_len = 16
-                }
+                couch_att:new([
+                    {name, <<"big.xml">>},
+                    {type, <<"xml/sucks">>},
+                    {data, fun() -> ok end},
+                    {revpos, 1},
+                    {att_len, 400},
+                    {disk_len, 400}
+                ]),
+                couch_att:new([
+                    {name, <<"fast.json">>},
+                    {type, <<"json/ftw">>},
+                    {data, <<"{\"so\": \"there!\"}">>},
+                    {revpos, 1},
+                    {att_len, 16},
+                    {disk_len, 16}
+                ])
             ]},
             {[
                 {<<"_id">>, <<>>},
@@ -153,20 +149,20 @@ test_to_json_success() ->
         {
             [attachments],
             #doc{atts=[
-                #att{
-                    name = <<"stuff.txt">>,
-                    type = <<"text/plain">>,
-                    data = fun() -> <<"diet pepsi">> end,
-                    revpos = 1,
-                    att_len = 10,
-                    disk_len = 10
-                },
-                #att{
-                    name = <<"food.now">>,
-                    type = <<"application/food">>,
-                    revpos = 1,
-                    data = <<"sammich">>
-                }
+                couch_att:new([
+                    {name, <<"stuff.txt">>},
+                    {type, <<"text/plain">>},
+                    {data, fun() -> <<"diet pepsi">> end},
+                    {revpos, 1},
+                    {att_len, 10},
+                    {disk_len, 10}
+                ]),
+                couch_att:new([
+                    {name, <<"food.now">>},
+                    {type, <<"application/food">>},
+                    {revpos, 1},
+                    {data, <<"sammich">>}
+                ])
             ]},
             {[
                 {<<"_id">>, <<>>},


[2/2] couchdb commit: updated refs/heads/windsor-merge to 31c3b32

Posted by rn...@apache.org.
Test all windsor-merge branches


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

Branch: refs/heads/windsor-merge
Commit: 31c3b32b68fcf58356b27c4cb0919fa2acb6d11d
Parents: 91294eb
Author: Robert Newson <rn...@apache.org>
Authored: Thu Aug 7 16:41:51 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Aug 7 16:41:51 2014 +0100

----------------------------------------------------------------------
 rebar.config.script | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/31c3b32b/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index afe0b0f..da43a08 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -19,27 +19,28 @@ os:putenv("COUCHDB_CONFIG", ConfigureEnv).
 DepDescs = [
     {cassim, "couchdb-cassim", {branch, "windsor-merge"}, []},
     {couch_log, "couchdb-couch-log", {branch, "master"}, []},
-    {config, "couchdb-config", {branch, "master"}, []},
-    {chttpd, "couchdb-chttpd", {branch, "master"}, []},
-    {couch, "couchdb-couch", {branch, "master"}, []},
+    {config, "couchdb-config", {branch, "windsor-merge"}, []},
+    {chttpd, "couchdb-chttpd", {branch, "windsor-merge"}, []},
+    {couch, "couchdb-couch", {branch, "windsor-merge"}, []},
     {couch_index, "couchdb-couch-index", {branch, "master"}, []},
-    {couch_mrview, "couchdb-couch-mrview", {branch, "master"}, []},
-    {couch_replicator, "couchdb-couch-replicator", {branch,  "master"}, []},
+    {couch_mrview, "couchdb-couch-mrview", {branch, "windsor-merge"}, []},
+    {couch_replicator, "couchdb-couch-replicator", {branch,  "windsor-merge"}, []},
     {couch_dbupdates, "couchdb-couch-dbupdates", {branch, "master"}, []},
     {couch_plugins, "couchdb-couch-plugins", {branch, "master"}, []},
     {couch_event, "couchdb-couch-event", {branch, "windsor-merge"}, []},
-    {ddoc_cache, "couchdb-ddoc-cache", {branch, "master"}, []},
-    {ets_lru, "couchdb-ets-lru", {branch, "master"}, []},
-    {fabric, "couchdb-fabric", {branch,  "master"}, []},
+    {ddoc_cache, "couchdb-ddoc-cache", {branch, "windsor-merge"}, []},
+    {ets_lru, "couchdb-ets-lru", {branch, "windsor-merge"}, []},
+    {fabric, "couchdb-fabric", {branch,  "windsor-merge"}, []},
     {ibrowse, "couchdb-ibrowse", {tag,  "master"}, []},
     {jiffy, "couchdb-jiffy", {branch, "master"}, []},
     {khash, "couchdb-khash", {branch, "windsor-merge"}, []},
     {mem3, "couchdb-mem3", {branch, "master"}, []},
     {mochiweb, "couchdb-mochiweb", {branch, "master"}, []},
     {oauth, "couchdb-oauth", {branch, "master"}, []},
-    {rexi, "couchdb-rexi", {branch, "master"}, []},
+    {rexi, "couchdb-rexi", {branch, "windsor-merge"}, []},
     {snappy, "couchdb-snappy", {branch, "1994-merge-rcouch"}, []},
     {b64url, "couchdb-b64url", {branch, "windsor-merge"}, []},
+    {global_changes, "couchdb-global-changes", {branch, "windsor-merge"}, []},
     {fauxton, "couchdb-fauxton", {branch, "master"}, [raw]},
     {docs, "couchdb-documentation", {branch, "master"}, [raw]}
 ],