couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject [2/5] git commit: use couch_db calls instead of couch_btree
Date Wed, 09 Nov 2011 10:07:20 GMT
use couch_db calls instead of couch_btree

couch_changes can use the interface from couch_db to access documents,
keeping the logic of the btree storage better encapsulated.


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

Branch: refs/heads/master
Commit: e41d226dca11dc8b24d6c011cc3014e6c553db42
Parents: 13f704b
Author: Randall Leeds <randall@apache.org>
Authored: Wed Nov 9 01:31:18 2011 -0800
Committer: Randall Leeds <randall@apache.org>
Committed: Wed Nov 9 01:42:40 2011 -0800

----------------------------------------------------------------------
 src/couchdb/couch_changes.erl |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e41d226d/src/couchdb/couch_changes.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
index 267f3d7..30f1d88 100644
--- a/src/couchdb/couch_changes.erl
+++ b/src/couchdb/couch_changes.erl
@@ -298,7 +298,7 @@ send_changes(Args, Callback, UserAcc, Db, StartSeq, Prepend, FirstRound)
->
 
 
 send_changes_doc_ids(DocIds, Db, StartSeq, Dir, Fun, Acc0) ->
-    Lookups = couch_btree:lookup(Db#db.fulldocinfo_by_id_btree, DocIds),
+    Lookups = couch_db:get_full_doc_infos(Db, DocIds),
     FullDocInfos = lists:foldl(
         fun({ok, FDI}, Acc) ->
             [FDI | Acc];
@@ -310,12 +310,7 @@ send_changes_doc_ids(DocIds, Db, StartSeq, Dir, Fun, Acc0) ->
 
 
 send_changes_design_docs(Db, StartSeq, Dir, Fun, Acc0) ->
-    FoldFun = fun(FullDocInfo, _, Acc) ->
-        {ok, [FullDocInfo | Acc]}
-    end,
-    KeyOpts = [{start_key, <<"_design/">>}, {end_key_gt, <<"_design0">>}],
-    {ok, _, FullDocInfos} = couch_btree:fold(
-        Db#db.fulldocinfo_by_id_btree, FoldFun, [], KeyOpts),
+    FullDocInfos = couch_db:get_design_docs(Db),
     send_lookup_changes(FullDocInfos, StartSeq, Dir, Db, Fun, Acc0).
 
 


Mime
View raw message