summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-15 11:29:08 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 11:18:45 -0400
commit6b0e1f6da54c61714b6aef1a7a7991ab8c13b631 (patch)
tree2a9935763e2997714ea963a8cfabb310896ec924 /src
parent6f4a995150978e67539546c3da804126e3a36389 (diff)
use 0.11 couch_uuids module
Diffstat (limited to 'src')
-rw-r--r--src/chttpd_auth.erl2
-rw-r--r--src/chttpd_db.erl4
-rw-r--r--src/chttpd_misc.erl19
-rw-r--r--src/chttpd_show.erl2
-rw-r--r--src/chttpd_view.erl2
5 files changed, 6 insertions, 23 deletions
diff --git a/src/chttpd_auth.erl b/src/chttpd_auth.erl
index 3916f7cf..4159b764 100644
--- a/src/chttpd_auth.erl
+++ b/src/chttpd_auth.erl
@@ -312,7 +312,7 @@ create_user(#httpd{method='POST', mochi_req=MochiReq}=Req, Db) ->
true -> ok end,
Active = chttpd_view:parse_bool_param(couch_util:get_value("active",
Form, "true")),
- UserSalt = couch_util:new_uuid(),
+ UserSalt = couch_uuids:random(),
UserDoc = #doc{
id = UserName,
body = {[
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 1d558a19..277a33bc 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -175,7 +175,7 @@ db_req(#httpd{method='POST',path_parts=[DbName], user_ctx=Ctx}=Req, Db) ->
Doc = couch_doc:from_json_obj(chttpd:json_body(Req)),
Doc2 = case Doc#doc.id of
<<"">> ->
- Doc#doc{id=couch_util:new_uuid(), revs={0, []}};
+ Doc#doc{id=couch_uuids:new(), revs={0, []}};
_ ->
Doc
end,
@@ -254,7 +254,7 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>], user_ctx=Ctx}=Req,
Doc = couch_doc:from_json_obj(JsonObj),
validate_attachment_names(Doc),
Id = case Doc#doc.id of
- <<>> -> couch_util:new_uuid();
+ <<>> -> couch_uuids:new();
Id0 -> Id0
end,
case couch_util:get_value(<<"_rev">>, ObjProps) of
diff --git a/src/chttpd_misc.erl b/src/chttpd_misc.erl
index e6d3c76a..26297d34 100644
--- a/src/chttpd_misc.erl
+++ b/src/chttpd_misc.erl
@@ -131,25 +131,8 @@ handle_restart_req(Req) ->
send_method_not_allowed(Req, "POST").
-handle_uuids_req(#httpd{method='GET'}=Req) ->
- Count = list_to_integer(chttpd:qs_value(Req, "count", "1")),
- % generate the uuids
- UUIDs = [ couch_util:new_uuid() || _ <- lists:seq(1,Count)],
- % send a JSON response
- Etag = chttpd:make_etag(UUIDs),
- chttpd:etag_respond(Req, Etag, fun() ->
- CacheBustingHeaders = [
- {"Date", httpd_util:rfc1123_date()},
- {"Cache-Control", "no-cache"},
- % Past date, ON PURPOSE!
- {"Expires", "Fri, 01 Jan 1990 00:00:00 GMT"},
- {"Pragma", "no-cache"},
- {"ETag", Etag}
- ],
- send_json(Req, 200, CacheBustingHeaders, {[{<<"uuids">>, UUIDs}]})
- end);
handle_uuids_req(Req) ->
- send_method_not_allowed(Req, "GET").
+ couch_httpd_misc_handlers:handle_uuids_req(Req).
% Config request handler
diff --git a/src/chttpd_show.erl b/src/chttpd_show.erl
index de10463f..9f4e0d02 100644
--- a/src/chttpd_show.erl
+++ b/src/chttpd_show.erl
@@ -148,7 +148,7 @@ send_view_list_response(Lang, ListSrc, ViewName, DesignId, Req, Db, Group, Keys)
QueryArgs = chttpd_view:parse_view_params(Req, Keys, ViewType),
{ok, QueryServer} = couch_query_servers:start_view_list(Lang, ListSrc),
StartListRespFun = make_map_start_resp_fun(QueryServer, Db),
- Etag = couch_util:new_uuid(),
+ Etag = couch_uuids:new(),
chttpd:etag_respond(Req, Etag, fun() ->
{ok, Total, Result} = ?COUCH:list_view(Req, Db, DesignId, ViewName,
Keys, QueryArgs, QueryServer),
diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl
index 8d071cac..a4d909a1 100644
--- a/src/chttpd_view.erl
+++ b/src/chttpd_view.erl
@@ -36,7 +36,7 @@ design_doc_view(Req, Db, GroupId, ViewName, Keys) ->
QueryArgs = parse_view_params(Req, Keys, ViewType),
% TODO proper calculation of etag
% Etag = view_group_etag(ViewGroup, Db, Keys),
- Etag = couch_util:new_uuid(),
+ Etag = couch_uuids:new(),
couch_stats_collector:increment({httpd, view_reads}),
chttpd:etag_respond(Req, Etag, fun() ->
{ok, Resp} = chttpd:start_json_response(Req, 200, [{"Etag",Etag}]),