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

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

Issue 660383002: Docserver: Persist stat cache for versioned file systems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 from file_system import FileSystem, FileNotFoundError 5 from file_system import FileSystem, FileNotFoundError
6 from future import Future 6 from future import Future
7 7
8 8
9 class OfflineFileSystem(FileSystem): 9 class OfflineFileSystem(FileSystem):
10 '''An offline FileSystem which masquerades as another file system. It throws 10 '''An offline FileSystem which masquerades as another file system. It throws
11 FileNotFound error for all operations, and overrides GetIdentity. 11 FileNotFound error for all operations, and overrides GetIdentity.
12 ''' 12 '''
13 def __init__(self, fs): 13 def __init__(self, fs):
14 self._fs = fs 14 self._fs = fs
15 15
16 def Read(self, paths, skip_not_found=False): 16 def Read(self, paths, skip_not_found=False):
17 if skip_not_found: return Future(value={}) 17 if skip_not_found: return Future(value={})
18 def raise_file_not_found(): 18 def raise_file_not_found():
19 raise FileNotFoundError('File system is offline, cannot read %s' % paths) 19 raise FileNotFoundError('File system is offline, cannot read %s' % paths)
20 return Future(callback=raise_file_not_found) 20 return Future(callback=raise_file_not_found)
21 21
22 def Stat(self, path): 22 def Stat(self, path):
23 raise FileNotFoundError('File system is offline, cannot read %s' % path) 23 raise FileNotFoundError('File system is offline, cannot read %s' % path)
24 24
25 def GetIdentity(self): 25 def GetIdentity(self):
26 return self._fs.GetIdentity() 26 return self._fs.GetIdentity()
27
28 def GetVersion(self):
29 return self._fs.GetVersion()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/mock_file_system.py ('k') | chrome/common/extensions/docs/server2/queue.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698