Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5654)

Unified Diff: chrome/common/extensions/docs/server2/handler.py

Issue 736773002: Docserver: Add commit history and _reset_commit servlet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup, test for commit reset Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/handler.py
diff --git a/chrome/common/extensions/docs/server2/handler.py b/chrome/common/extensions/docs/server2/handler.py
index a0e044e753aab96ad34bc124736999020b42f372..c6a2eedc65b77d31359169083497aebb376084ae 100644
--- a/chrome/common/extensions/docs/server2/handler.py
+++ b/chrome/common/extensions/docs/server2/handler.py
@@ -4,11 +4,10 @@
import time
-from appengine_wrappers import taskqueue
-from commit_tracker import CommitTracker
+from admin_servlets import (DumpRefreshServlet, EnqueueServlet,
+ QueryCommitServlet, ResetCommitServlet)
from cron_servlet import CronServlet
from instance_servlet import InstanceServlet
-from object_store_creator import ObjectStoreCreator
from patch_servlet import PatchServlet
from refresh_servlet import RefreshServlet
from servlet import Servlet, Request, Response
@@ -18,55 +17,15 @@ from test_servlet import TestServlet
_DEFAULT_SERVLET = InstanceServlet.GetConstructor()
-class _EnqueueServlet(Servlet):
- '''This Servlet can be used to manually enqueue tasks on the default
- taskqueue. Useful for when an admin wants to manually force a specific
- DataSource refresh, but the refresh operation takes longer than the 60 sec
- timeout of a non-taskqueue request. For example, you might query
-
- /_enqueue/_refresh/content_providers/cr-native-client?commit=123ff65468dcafff0
-
- which will enqueue a task (/_refresh/content_providers/cr-native-client) to
- refresh the NaCl documentation cache for commit 123ff65468dcafff0.
-
- Access to this servlet should always be restricted to administrative users.
- '''
- def __init__(self, request):
- Servlet.__init__(self, request)
-
- def Get(self):
- queue = taskqueue.Queue()
- queue.add(taskqueue.Task(url='/%s' % self._request.path,
- params=self._request.arguments))
- return Response.Ok('Task enqueued.')
-
-
-class _QueryCommitServlet(Servlet):
- '''Provides read access to the commit ID cache within the server. For example:
-
- /_query_commit/master
-
- will return the commit ID stored under the commit key "master" within the
- commit cache. Currently "master" is the only named commit we cache, and it
- corresponds to the commit ID whose data currently populates the data cache
- used by live instances.
- '''
- def __init__(self, request):
- Servlet.__init__(self, request)
-
- def Get(self):
- object_store_creator = ObjectStoreCreator(start_empty=False)
- commit_tracker = CommitTracker(object_store_creator)
- return Response.Ok(commit_tracker.Get(self._request.path).Get())
-
-
_SERVLETS = {
'cron': CronServlet,
- 'enqueue': _EnqueueServlet,
+ 'enqueue': EnqueueServlet,
'patch': PatchServlet,
- 'query_commit': _QueryCommitServlet,
+ 'query_commit': QueryCommitServlet,
'refresh': RefreshServlet,
+ 'reset_commit': ResetCommitServlet,
'test': TestServlet,
+ 'dump_refresh': DumpRefreshServlet,
}

Powered by Google App Engine
This is Rietveld 408576698