OLD | NEW |
---|---|
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 class FileSystem(object): | 5 class FileSystem(object): |
6 """A FileSystem interface that can read files and directories. | 6 """A FileSystem interface that can read files and directories. |
7 """ | 7 """ |
8 class StatInfo(object): | 8 class StatInfo(object): |
9 """The result of calling Stat on a FileSystem. | 9 """The result of calling Stat on a FileSystem. |
10 """ | 10 """ |
11 def __init__(self, version): | 11 def __init__(self, version): |
12 self.version = version | 12 self.version = version |
13 | 13 |
14 def Read(self, paths): | 14 def Read(self, paths): |
15 """Reads each file in paths and returns a dictionary mapping the path to the | 15 """Reads each file in paths and returns a dictionary mapping the path to the |
16 contents. If a path in paths ends with a '/', it is assumed to be a | 16 contents. If a path in paths ends with a '/', it is assumed to be a |
17 directory, and a list of files in the directory is mapped to the path. | 17 directory, and a list of files in the directory is mapped to the path. |
18 """ | 18 """ |
19 raise NotImplementedError() | 19 raise NotImplementedError() |
20 | 20 |
21 def ReadSingleFile(self, path): | |
not at google - send to devlin
2012/07/23 13:25:37
oh this works for directories as well as files. Oo
cduvall
2012/07/23 18:10:37
Done.
| |
22 """Reads a single file from the FileSystem. | |
23 """ | |
24 return self.Read([path]).Get()[path] | |
25 | |
21 def Stat(self, path): | 26 def Stat(self, path): |
22 """Gets the version number of |path| if it is a directory, or the parent | 27 """Gets the version number of |path| if it is a directory, or the parent |
23 directory if it is a file. | 28 directory if it is a file. |
24 """ | 29 """ |
25 raise NotImplementedError() | 30 raise NotImplementedError() |
OLD | NEW |