Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 import logging | 5 import logging |
| 6 import time | 6 import time |
| 7 import traceback | 7 import traceback |
| 8 | 8 |
| 9 from app_yaml_helper import AppYamlHelper | 9 from app_yaml_helper import AppYamlHelper |
| 10 from appengine_wrappers import ( | 10 from appengine_wrappers import ( |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 class Delegate(object): | 40 class Delegate(object): |
| 41 '''CronServlet's runtime dependencies. Override for testing. | 41 '''CronServlet's runtime dependencies. Override for testing. |
| 42 ''' | 42 ''' |
| 43 def CreateBranchUtility(self, object_store_creator): | 43 def CreateBranchUtility(self, object_store_creator): |
| 44 return BranchUtility.Create(object_store_creator) | 44 return BranchUtility.Create(object_store_creator) |
| 45 | 45 |
| 46 def CreateHostFileSystemForBranchAndRevision(self, branch, revision): | 46 def CreateHostFileSystemForBranchAndRevision(self, branch, revision): |
| 47 return SubversionFileSystem.Create(branch, revision=revision) | 47 return SubversionFileSystem.Create(branch, revision=revision) |
| 48 | 48 |
| 49 def CreateFileSystemForBranch(self, branch): | |
| 50 return SubversionFileSystem.Create(branch) | |
|
not at google - send to devlin
2013/07/03 19:54:56
maybe we should just rename CreateHostFIleSystemFo
epeterson
2013/07/09 20:51:18
The cron_servlet_test likes to count up how many f
not at google - send to devlin
2013/07/09 23:11:55
ah right. and this does actually break the test? I
| |
| 51 | |
| 49 def CreateAppSamplesFileSystem(self, object_store_creator): | 52 def CreateAppSamplesFileSystem(self, object_store_creator): |
| 50 # TODO(kalman): CachingFileSystem wrapper for GithubFileSystem, but it's | 53 # TODO(kalman): CachingFileSystem wrapper for GithubFileSystem, but it's |
| 51 # not supported yet (see comment there). | 54 # not supported yet (see comment there). |
| 52 return (EmptyDirFileSystem() if IsDevServer() else | 55 return (EmptyDirFileSystem() if IsDevServer() else |
| 53 GithubFileSystem.Create(object_store_creator)) | 56 GithubFileSystem.Create(object_store_creator)) |
| 54 | 57 |
| 55 def GetAppVersion(self): | 58 def GetAppVersion(self): |
| 56 return GetAppVersion() | 59 return GetAppVersion() |
| 57 | 60 |
| 58 def Get(self): | 61 def Get(self): |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 host_file_system = CachingFileSystem( | 227 host_file_system = CachingFileSystem( |
| 225 self._delegate.CreateHostFileSystemForBranchAndRevision( | 228 self._delegate.CreateHostFileSystemForBranchAndRevision( |
| 226 self._GetBranchForChannel(channel), | 229 self._GetBranchForChannel(channel), |
| 227 revision), | 230 revision), |
| 228 object_store_creator) | 231 object_store_creator) |
| 229 app_samples_file_system = self._delegate.CreateAppSamplesFileSystem( | 232 app_samples_file_system = self._delegate.CreateAppSamplesFileSystem( |
| 230 object_store_creator) | 233 object_store_creator) |
| 231 compiled_host_fs_factory = CompiledFileSystem.Factory( | 234 compiled_host_fs_factory = CompiledFileSystem.Factory( |
| 232 host_file_system, | 235 host_file_system, |
| 233 object_store_creator) | 236 object_store_creator) |
| 237 branch_utility = self._delegate.CreateBranchUtility(object_store_creator) | |
| 238 def create_file_system(version): | |
| 239 return CachingFileSystem( | |
| 240 self._delegate.CreateFileSystemForBranch( | |
| 241 branch_utility.GetBranchForVersion(version)), | |
| 242 object_store_creator) | |
|
not at google - send to devlin
2013/07/03 19:54:56
let's introduce a class like HostFileSystemCreator
epeterson
2013/07/09 20:51:18
Done.
| |
| 234 return ServerInstance(channel, | 243 return ServerInstance(channel, |
| 235 object_store_creator, | 244 object_store_creator, |
| 236 host_file_system, | 245 host_file_system, |
| 237 app_samples_file_system, | 246 app_samples_file_system, |
| 238 '' if channel == 'stable' else '/%s' % channel, | 247 '' if channel == 'stable' else '/%s' % channel, |
| 239 compiled_host_fs_factory) | 248 compiled_host_fs_factory, |
| 249 branch_utility, | |
| 250 create_file_system) | |
| OLD | NEW |