Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Inline open_doc_revs into open_docs
This function was trivial and never reused. It was more confusing to
have it as a separate function rather than just inlining into where it's
used.
  • Loading branch information
davisp authored and rnewson committed Jul 23, 2014
1 parent fcbc821 commit 36a1e63ad120dc1c3d1382119395aee42b555100
Showing 1 changed file with 5 additions and 8 deletions.
@@ -204,17 +204,14 @@ save_on_target(Node, Name, Docs) ->
open_docs(#acc{source=Source, infos=Infos}, Missing) ->
lists:flatmap(fun({Id, Revs, _}) ->
FDI = lists:keyfind(Id, #full_doc_info.id, Infos),
open_doc_revs(Source, FDI, Revs)
RevTree = FDI#full_doc_info.rev_tree,
{FoundRevs, _} = couch_key_tree:get_key_leafs(RevTree, Revs),
lists:map(fun({#leaf{deleted=IsDel, ptr=SummaryPtr}, FoundRevPath}) ->
couch_db:make_doc(Source, Id, IsDel, SummaryPtr, FoundRevPath)
end, FoundRevs)
end, Missing).


open_doc_revs(Db, #full_doc_info{id=Id, rev_tree=RevTree}, Revs) ->
{FoundRevs, _} = couch_key_tree:get_key_leafs(RevTree, Revs),
lists:map(fun({#leaf{deleted=IsDel, ptr=SummaryPtr}, FoundRevPath}) ->
couch_db:make_doc(Db, Id, IsDel, SummaryPtr, FoundRevPath)
end, FoundRevs).


update_locals(Acc) ->
#acc{seq=Seq, source=Db, target=Target, localid=Id} = Acc,
#shard{name=Name, node=Node} = Target,

0 comments on commit 36a1e63

Please sign in to comment.