diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-02-15 20:36:53 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-02-15 20:36:53 +0000 |
commit | 146bc594aef47b675670e7a7fd7f89b7c6a10843 (patch) | |
tree | 4f1ea083353560951b640f8c1ceaaf728e2def65 /src/couchdb/couch_view.erl | |
parent | c91f851dc421466402721eb7baa644860f874ce1 (diff) |
View etags are now provided. See note in the source about how they could be more efficient. Changes arity on make_view_fold_fun etc. Closes COUCHDB-4
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@744747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_view.erl')
-rw-r--r-- | src/couchdb/couch_view.erl | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl index 5a7926b2..5fb2ec5a 100644 --- a/src/couchdb/couch_view.erl +++ b/src/couchdb/couch_view.erl @@ -61,14 +61,19 @@ get_row_count(#view{btree=Bt}) -> {ok, Count}. get_temp_reduce_view(Db, Type, DesignOptions, MapSrc, RedSrc) -> - {ok, #group{views=[View]}} = get_temp_group(Db, Type, DesignOptions, MapSrc, RedSrc), - {ok, {temp_reduce, View}}. + {ok, #group{views=[View]}=Group} = get_temp_group(Db, Type, DesignOptions, MapSrc, RedSrc), + {ok, {temp_reduce, View}, Group}. get_reduce_view(Db, GroupId, Name, Update) -> case get_group(Db, GroupId, Update) of - {ok, #group{views=Views,def_lang=Lang}} -> - get_reduce_view0(Name, Lang, Views); + {ok, #group{views=Views,def_lang=Lang}=Group} -> + case get_reduce_view0(Name, Lang, Views) of + {ok, View} -> + {ok, View, Group}; + Else -> + Else + end; Error -> Error end. @@ -137,13 +142,18 @@ get_key_pos(Key, [_|Rest], N) -> get_temp_map_view(Db, Type, DesignOptions, Src) -> - {ok, #group{views=[View]}} = get_temp_group(Db, Type, DesignOptions, Src, []), - {ok, View}. + {ok, #group{views=[View]}=Group} = get_temp_group(Db, Type, DesignOptions, Src, []), + {ok, View, Group}. get_map_view(Db, GroupId, Name, Stale) -> case get_group(Db, GroupId, Stale) of - {ok, #group{views=Views}} -> - get_map_view0(Name, Views); + {ok, #group{views=Views}=Group} -> + case get_map_view0(Name, Views) of + {ok, View} -> + {ok, View, Group}; + Else -> + Else + end; Error -> Error end. |