You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2014/02/13 01:21:43 UTC
fabric commit: updated refs/heads/1993-bigcouch-couch-mrview to
09c9e8c
Updated Branches:
refs/heads/1993-bigcouch-couch-mrview 32d373975 -> 09c9e8c76
Remove fabric functions replaced by couch_mrview
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/09c9e8c7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/09c9e8c7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/09c9e8c7
Branch: refs/heads/1993-bigcouch-couch-mrview
Commit: 09c9e8c7638478cff3604d35a35da4611c1f3437
Parents: 32d3739
Author: Russell Branca <ch...@gmail.com>
Authored: Wed Feb 12 16:21:54 2014 -0800
Committer: Russell Branca <ch...@gmail.com>
Committed: Wed Feb 12 16:21:54 2014 -0800
----------------------------------------------------------------------
src/fabric_rpc.erl | 109 ------------------------------------------------
1 file changed, 109 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/09c9e8c7/src/fabric_rpc.erl
----------------------------------------------------------------------
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index bc3112d..1d24271 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -75,20 +75,6 @@ reduce_view(DbName, DDoc, ViewName, Args) ->
VAcc0 = #vacc{db=Db},
couch_mrview:query_view(Db, DDoc, ViewName, Args, fun reduce_cb/2, VAcc0).
-calculate_seqs(Db, Stale) ->
- LastSeq = couch_db:get_update_seq(Db),
- if
- Stale == ok orelse Stale == update_after ->
- {LastSeq, 0};
- true ->
- {LastSeq, LastSeq}
- end.
-
-maybe_update_view_group(GroupPid, LastSeq, update_after) ->
- couch_view_group:trigger_group_update(GroupPid, LastSeq);
-maybe_update_view_group(_, _, _) ->
- ok.
-
create_db(DbName) ->
rexi:reply(case couch_server:create(DbName, []) of
{ok, _} ->
@@ -260,101 +246,6 @@ reduce_cb(complete, Acc) ->
rexi:reply(complete),
{ok, Acc}.
-view_fold(#full_doc_info{} = FullDocInfo, OffsetReds, Acc) ->
- % matches for _all_docs and translates #full_doc_info{} -> KV pair
- case couch_doc:to_doc_info(FullDocInfo) of
- #doc_info{id=Id, revs=[#rev_info{deleted=false, rev=Rev}|_]} = DI ->
- Value = {[{rev,couch_doc:rev_to_str(Rev)}]},
- view_fold({{Id,Id}, Value}, OffsetReds, Acc#view_acc{doc_info=DI});
- #doc_info{revs=[#rev_info{deleted=true}|_]} ->
- {ok, Acc}
- end;
-view_fold(KV, OffsetReds, #view_acc{offset=nil, total_rows=Total} = Acc) ->
- % calculates the offset for this shard
- #view_acc{reduce_fun=Reduce} = Acc,
- Offset = Reduce(OffsetReds),
- case rexi:sync_reply({total_and_offset, Total, Offset}) of
- ok ->
- view_fold(KV, OffsetReds, Acc#view_acc{offset=Offset});
- stop ->
- exit(normal);
- timeout ->
- exit(timeout)
- end;
-view_fold(_KV, _Offset, #view_acc{limit=0} = Acc) ->
- % we scanned through limit+skip local rows
- {stop, Acc};
-view_fold({{Key,Id}, Value}, _Offset, Acc) ->
- % the normal case
- #view_acc{
- db = Db,
- doc_info = DocInfo,
- limit = Limit,
- conflicts = Conflicts,
- include_docs = IncludeDocs
- } = Acc,
- case Value of {Props} ->
- LinkedDocs = (couch_util:get_value(<<"_id">>, Props) =/= undefined);
- _ ->
- LinkedDocs = false
- end,
- if LinkedDocs ->
- % we'll embed this at a higher level b/c the doc may be non-local
- Doc = undefined;
- IncludeDocs ->
- IdOrInfo = if DocInfo =/= nil -> DocInfo; true -> Id end,
- Options = if Conflicts -> [conflicts]; true -> [] end,
- case couch_db:open_doc(Db, IdOrInfo, Options) of
- {not_found, deleted} ->
- Doc = null;
- {not_found, missing} ->
- Doc = undefined;
- {ok, Doc0} ->
- Doc = couch_doc:to_json_obj(Doc0, [])
- end;
- true ->
- Doc = undefined
- end,
- case rexi:stream(#view_row{key=Key, id=Id, value=Value, doc=Doc}) of
- ok ->
- {ok, Acc#view_acc{limit=Limit-1}};
- timeout ->
- exit(timeout)
- end.
-
-final_response(Total, nil) ->
- case rexi:sync_reply({total_and_offset, Total, Total}) of ok ->
- rexi:reply(complete);
- stop ->
- ok;
- timeout ->
- exit(timeout)
- end;
-final_response(_Total, _Offset) ->
- rexi:reply(complete).
-
-%% TODO: handle case of bogus group level
-group_rows_fun(exact) ->
- fun({Key1,_}, {Key2,_}) -> Key1 == Key2 end;
-group_rows_fun(0) ->
- fun(_A, _B) -> true end;
-group_rows_fun(GroupLevel) when is_integer(GroupLevel) ->
- fun({[_|_] = Key1,_}, {[_|_] = Key2,_}) ->
- lists:sublist(Key1, GroupLevel) == lists:sublist(Key2, GroupLevel);
- ({Key1,_}, {Key2,_}) ->
- Key1 == Key2
- end.
-
-reduce_fold(_Key, _Red, #view_acc{limit=0} = Acc) ->
- {stop, Acc};
-reduce_fold(_Key, Red, #view_acc{group_level=0} = Acc) ->
- send(null, Red, Acc);
-reduce_fold(Key, Red, #view_acc{group_level=exact} = Acc) ->
- send(Key, Red, Acc);
-reduce_fold(K, Red, #view_acc{group_level=I} = Acc) when I > 0, is_list(K) ->
- send(lists:sublist(K, I), Red, Acc);
-reduce_fold(K, Red, #view_acc{group_level=I} = Acc) when I > 0 ->
- send(K, Red, Acc).
send(Key, Value, Acc) ->
case put(fabric_sent_first_row, true) of