Randall, I have to disagree on this one. The reason to not call couch_db:get_design_docs/1 is to avoid reading the body of the documents, which is not needed.
Plus, couch_db:get_design_docs/1 skips deleted documents, which will causes _changes rows to be skipped. On Wed, Nov 9, 2011 at 10:07 AM, <[email protected]> wrote: > 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 <[email protected]> > Authored: Wed Nov 9 01:31:18 2011 -0800 > Committer: Randall Leeds <[email protected]> > 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). > > > > -- Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
