| OLD | NEW |
| 1 # Copyright 2014 The Swarming Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Versioned singleton entity with global application configuration. | 5 """Versioned singleton entity with global application configuration. |
| 6 | 6 |
| 7 Example usage: | 7 Example usage: |
| 8 from components.datastore_utils import config | 8 from components.datastore_utils import config |
| 9 | 9 |
| 10 class MyConfig(config.GlobalConfig): | 10 class MyConfig(config.GlobalConfig): |
| 11 param1 = ndb.StringProperty() | 11 param1 = ndb.StringProperty() |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 _config_fetcher_async = None | 151 _config_fetcher_async = None |
| 152 | 152 |
| 153 @classmethod | 153 @classmethod |
| 154 def _get_root_model(cls): | 154 def _get_root_model(cls): |
| 155 return datastore_utils.get_versioned_root_model('%sRoot' % cls.__name__) | 155 return datastore_utils.get_versioned_root_model('%sRoot' % cls.__name__) |
| 156 | 156 |
| 157 @classmethod | 157 @classmethod |
| 158 def _get_root_key(cls): | 158 def _get_root_key(cls): |
| 159 return ndb.Key(cls._get_root_model(), 1) | 159 return ndb.Key(cls._get_root_model(), 1) |
| OLD | NEW |