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 from collections import Mapping | 5 from collections import Mapping |
6 import os | 6 import os |
7 | 7 |
8 from api_schema_graph import APISchemaGraph | 8 from api_schema_graph import APISchemaGraph |
9 from branch_utility import BranchUtility | 9 from branch_utility import BranchUtility |
10 from compiled_file_system import CompiledFileSystem | 10 from compiled_file_system import CompiledFileSystem |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return availability | 222 return availability |
223 | 223 |
224 def GetApiNodeAvailability(self, api_name): | 224 def GetApiNodeAvailability(self, api_name): |
225 '''Returns an APISchemaGraph annotated with each node's availability (the | 225 '''Returns an APISchemaGraph annotated with each node's availability (the |
226 ChannelInfo at the oldest channel it's available in). | 226 ChannelInfo at the oldest channel it's available in). |
227 ''' | 227 ''' |
228 availability_graph = self._node_level_object_store.Get(api_name).Get() | 228 availability_graph = self._node_level_object_store.Get(api_name).Get() |
229 if availability_graph is not None: | 229 if availability_graph is not None: |
230 return availability_graph | 230 return availability_graph |
231 | 231 |
232 | |
233 availability_graph = APISchemaGraph() | 232 availability_graph = APISchemaGraph() |
234 trunk_graph = APISchemaGraph(_GetApiSchema(api_name, | 233 trunk_graph = APISchemaGraph(_GetApiSchema(api_name, |
235 self._host_file_system)) | 234 self._host_file_system)) |
236 def update_availability_graph(file_system, channel_info): | 235 def update_availability_graph(file_system, channel_info): |
237 version_graph = APISchemaGraph(_GetApiSchema(api_name, file_system)) | 236 version_graph = APISchemaGraph(_GetApiSchema(api_name, file_system)) |
238 # Keep track of any new schema elements from this version by adding | 237 # Keep track of any new schema elements from this version by adding |
239 # them to |availability_graph|. | 238 # them to |availability_graph|. |
240 # | 239 # |
241 # Calling |availability_graph|.Lookup() on the nodes being updated | 240 # Calling |availability_graph|.Lookup() on the nodes being updated |
242 # will return the |annotation| object. | 241 # will return the |annotation| object. |
243 availability_graph.Update(version_graph.Subtract(availability_graph), | 242 availability_graph.Update(version_graph.Subtract(availability_graph), |
244 annotation=channel_info) | 243 annotation=channel_info) |
245 | 244 |
246 # Continue looping until there are no longer differences between this | 245 # Continue looping until there are no longer differences between this |
247 # version and trunk. | 246 # version and trunk. |
248 return trunk_graph != version_graph | 247 return trunk_graph != version_graph |
249 | 248 |
250 self._file_system_iterator.Ascending(self.GetApiAvailability(api_name), | 249 self._file_system_iterator.Ascending(self.GetApiAvailability(api_name), |
251 update_availability_graph) | 250 update_availability_graph) |
252 | 251 |
253 self._node_level_object_store.Set(api_name, availability_graph) | 252 self._node_level_object_store.Set(api_name, availability_graph) |
254 return availability_graph | 253 return availability_graph |
OLD | NEW |