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

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

Issue 10829348: Extensions Docs Server: Large performance increase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/github_file_system.py
diff --git a/chrome/common/extensions/docs/server2/github_file_system.py b/chrome/common/extensions/docs/server2/github_file_system.py
index ccb51c44185f7f9b428f70eeadb145e063fc0d69..b518b202d5e7e442fdf9667f922cbaf22156c722 100644
--- a/chrome/common/extensions/docs/server2/github_file_system.py
+++ b/chrome/common/extensions/docs/server2/github_file_system.py
@@ -6,8 +6,8 @@ import json
import os
import appengine_blobstore as blobstore
-import appengine_memcache as memcache
-import file_system
+import object_store
+from file_system import FileSystem, StatInfo
from io import BytesIO
from future import Future
from zipfile import ZipFile
@@ -33,12 +33,12 @@ class _AsyncFetchFutureZip(object):
blobstore.BLOBSTORE_GITHUB)
return ZipFile(BytesIO(blob))
-class GithubFileSystem(file_system.FileSystem):
+class GithubFileSystem(FileSystem):
"""FileSystem implementation which fetches resources from github.
"""
- def __init__(self, fetcher, memcache, blobstore):
+ def __init__(self, fetcher, object_store, blobstore):
self._fetcher = fetcher
- self._memcache = memcache
+ self._object_store = object_store
self._blobstore = blobstore
self._version = self.Stat(ZIP_KEY).version
self._GetZip(self._version)
@@ -82,10 +82,10 @@ class GithubFileSystem(file_system.FileSystem):
return Future(value=result)
def Stat(self, path):
- version = self._memcache.Get(path, memcache.MEMCACHE_GITHUB_STAT)
+ version = self._object_store.Get(path, object_store.GITHUB_STAT)
if version is not None:
- return self.StatInfo(version)
+ return StatInfo(version)
version = json.loads(
self._fetcher.Fetch('commits/HEAD').content)['commit']['tree']['sha']
- self._memcache.Set(path, version, memcache.MEMCACHE_GITHUB_STAT)
- return self.StatInfo(version)
+ self._object_store.Set(path, version, object_store.GITHUB_STAT)
+ return StatInfo(version)

Powered by Google App Engine
This is Rietveld 408576698