summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-09-03 12:45:17 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-09-03 12:48:41 -0400
commitbcd9ed8f2397a5c238b0640aab3ceb9841d96794 (patch)
tree6a263c5b50369a980d9e8e92a5af3b5876410fae /apps
parent5a77f1120c80b62e3c1534eeaad53fb2dbf77b7b (diff)
support for _view_cleanup via HTTP
Diffstat (limited to 'apps')
-rw-r--r--apps/chttpd/src/chttpd_db.erl6
-rw-r--r--apps/fabric/src/fabric.erl3
2 files changed, 5 insertions, 4 deletions
diff --git a/apps/chttpd/src/chttpd_db.erl b/apps/chttpd/src/chttpd_db.erl
index 58897e0a..18bd6f44 100644
--- a/apps/chttpd/src/chttpd_db.erl
+++ b/apps/chttpd/src/chttpd_db.erl
@@ -118,9 +118,9 @@ handle_compact_req(Req, _) ->
Msg = <<"Compaction is handled automatically by Cloudant">>,
couch_httpd:send_error(Req, 403, forbidden, Msg).
-handle_view_cleanup_req(Req, _) ->
- Msg = <<"Old view indices are purged automatically by Cloudant">>,
- couch_httpd:send_error(Req, 403, forbidden, Msg).
+handle_view_cleanup_req(Req, Db) ->
+ ok = fabric:cleanup_index_files(Db),
+ send_json(Req, 202, {[{ok, true}]}).
handle_design_req(#httpd{
path_parts=[_DbName, _Design, Name, <<"_",_/binary>> = Action | _Rest],
diff --git a/apps/fabric/src/fabric.erl b/apps/fabric/src/fabric.erl
index d620b985..9f9db032 100644
--- a/apps/fabric/src/fabric.erl
+++ b/apps/fabric/src/fabric.erl
@@ -189,7 +189,8 @@ cleanup_index_files(DbName) ->
re:run(FilePath, RegExp, [{capture, none}]) == nomatch
end, FileList)
end,
- [file:delete(File) || File <- DeleteFiles].
+ [file:delete(File) || File <- DeleteFiles],
+ ok.
%% some simple type validation and transcoding