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

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

Issue 1151283007: Docserver overhaul: Gitiles away from me. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove inform_users template to fix presubmit failure (it's now a redirect) Created 5 years, 6 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/persistent_object_store.py
diff --git a/chrome/common/extensions/docs/server2/persistent_object_store.py b/chrome/common/extensions/docs/server2/persistent_object_store.py
deleted file mode 100644
index c0ae8734c01cdaeab51f7c1ada93c1b8b2f35dd5..0000000000000000000000000000000000000000
--- a/chrome/common/extensions/docs/server2/persistent_object_store.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-from appengine_wrappers import db
-from datastore_models import PersistentObjectStoreItem
-from environment import IsDevServer
-from future import All, Future
-from object_store import ObjectStore
-
-
-class PersistentObjectStore(ObjectStore):
- '''Stores data persistently using the AppEngine Datastore API.
- '''
- def __init__(self, namespace):
- self._namespace = namespace
-
- def SetMulti(self, mapping):
- rpcs = [db.put_async(
- PersistentObjectStoreItem.CreateItem(self._namespace, key, value))
- for key, value in mapping.iteritems()]
- # If running the dev server, the futures don't complete until the server is
- # *quitting*. This is annoying. Flush now.
- if IsDevServer():
- [rpc.wait() for rpc in rpcs]
- return All(Future(callback=lambda: rpc.get_result()) for rpc in rpcs)
-
- def GetMulti(self, keys):
- db_futures = dict(
- (k, db.get_async(
- PersistentObjectStoreItem.CreateKey(self._namespace, k)))
- for k in keys)
- def resolve():
- return dict((key, future.get_result().GetValue())
- for key, future in db_futures.iteritems()
- if future.get_result() is not None)
- return Future(callback=resolve)
-
- def DelMulti(self, keys):
- futures = []
- for key in keys:
- futures.append(db.delete_async(
- PersistentObjectStoreItem.CreateKey(self._namespace, key)))
- # If running the dev server, the futures don't complete until the server is
- # *quitting*. This is annoying. Flush now.
- if IsDevServer():
- [future.wait() for future in futures]

Powered by Google App Engine
This is Rietveld 408576698