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

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

Issue 429723005: Docserver: Only fetch content versions in the crons, not their contents. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no getfileversion Created 6 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/compiled_file_system.py
diff --git a/chrome/common/extensions/docs/server2/compiled_file_system.py b/chrome/common/extensions/docs/server2/compiled_file_system.py
index 58ab967240dd191cd3200c8cc9cbde0bf4ae9182..dc6a427fc8f387a3d03eb8265480df8cdda1f9cd 100644
--- a/chrome/common/extensions/docs/server2/compiled_file_system.py
+++ b/chrome/common/extensions/docs/server2/compiled_file_system.py
@@ -229,21 +229,25 @@ class CompiledFileSystem(object):
return cache_data
return self._RecursiveList(path).Then(next)
- def GetFileVersion(self, path):
+ # _GetFileVersionFromCache and _GetFileListingVersionFromCache are exposed
+ # *only* so that ChainedCompiledFileSystem can optimise its caches. *Do not*
+ # use these methods otherwise, they don't do what you want. Use
+ # FileSystem.Stat on the FileSystem that this CompiledFileSystem uses.
+
+ def _GetFileVersionFromCache(self, path):
cache_entry = self._file_object_store.Get(path).Get()
if cache_entry is not None:
- return cache_entry.version
- return self._file_system.Stat(path).version
+ return Future(value=cache_entry.version)
+ stat_future = self._file_system.StatAsync(path)
+ return Future(callback=lambda: stat_future.Get().version)
- def GetFileListingVersion(self, path):
+ def _GetFileListingVersionFromCache(self, path):
path = ToDirectory(path)
cache_entry = self._list_object_store.Get(path).Get()
if cache_entry is not None:
- return cache_entry.version
- return self._file_system.Stat(path).version
-
- def FileExists(self, path):
- return self._file_system.Exists(path)
+ return Future(value=cache_entry.version)
+ stat_future = self._file_system.StatAsync(path)
+ return Future(callback=lambda: stat_future.Get().version)
def GetIdentity(self):
return self._file_system.GetIdentity()

Powered by Google App Engine
This is Rietveld 408576698