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

Side by Side Diff: chrome/common/extensions/docs/server2/caching_file_system.py

Issue 491653002: Docserver: Use GitilesFileSystem instead of SubversionFileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import posixpath 5 import posixpath
6 import sys 6 import sys
7 7
8 from file_system import FileSystem, StatInfo, FileNotFoundError 8 from file_system import FileSystem, StatInfo, FileNotFoundError
9 from future import Future 9 from future import Future
10 from path_util import IsDirectory, ToDirectory 10 from path_util import IsDirectory, ToDirectory
(...skipping 15 matching lines...) Expand all
26 self._stat_object_store = create_object_store('stat') 26 self._stat_object_store = create_object_store('stat')
27 # The read caches can start populated (start_empty=False) because file 27 # The read caches can start populated (start_empty=False) because file
28 # updates are picked up by the stat, so it doesn't need the force-refresh 28 # updates are picked up by the stat, so it doesn't need the force-refresh
29 # which starting empty is designed for. Without this optimisation, cron 29 # which starting empty is designed for. Without this optimisation, cron
30 # runs are extra slow. 30 # runs are extra slow.
31 self._read_object_store = create_object_store('read', start_empty=False) 31 self._read_object_store = create_object_store('read', start_empty=False)
32 32
33 def Refresh(self): 33 def Refresh(self):
34 return self._file_system.Refresh() 34 return self._file_system.Refresh()
35 35
36 def GetCommitID(self):
37 return self._file_system.GetCommitID()
38
36 def Stat(self, path): 39 def Stat(self, path):
37 return self.StatAsync(path).Get() 40 return self.StatAsync(path).Get()
38 41
39 def StatAsync(self, path): 42 def StatAsync(self, path):
40 '''Stats the directory given, or if a file is given, stats the file's parent 43 '''Stats the directory given, or if a file is given, stats the file's parent
41 directory to get info about the file. 44 directory to get info about the file.
42 ''' 45 '''
43 # Always stat the parent directory, since it will have the stat of the child 46 # Always stat the parent directory, since it will have the stat of the child
44 # anyway, and this gives us an entire directory's stat info at once. 47 # anyway, and this gives us an entire directory's stat info at once.
45 dir_path, file_path = posixpath.split(path) 48 dir_path, file_path = posixpath.split(path)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return new_results 128 return new_results
126 # Read in the values that were uncached or old. 129 # Read in the values that were uncached or old.
127 return self._file_system.Read(set(paths) - set(fresh_data.iterkeys()), 130 return self._file_system.Read(set(paths) - set(fresh_data.iterkeys()),
128 skip_not_found=skip_not_found).Then(next) 131 skip_not_found=skip_not_found).Then(next)
129 132
130 def GetIdentity(self): 133 def GetIdentity(self):
131 return self._file_system.GetIdentity() 134 return self._file_system.GetIdentity()
132 135
133 def __repr__(self): 136 def __repr__(self):
134 return '%s of <%s>' % (type(self).__name__, repr(self._file_system)) 137 return '%s of <%s>' % (type(self).__name__, repr(self._file_system))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698